The .profile file has only exit command


 
Thread Tools Search this Thread
Operating Systems Solaris The .profile file has only exit command
# 1  
Old 06-21-2011
Question The .profile file has only exit command

Hi everyone,

This is my first post in the forum. :-)

I was asked this question for an interview recently.

Q: What will happen if the .profile file has only the exit command in it and nothing else.
(Assume that every other settings are in place to run the .profile file, when the user logs in.)

I don't know the answer yet.
I thought of two possible answers :

1: The next time the user tries to login the .profile gets executed and the user will be logged out of the session. In short, the user will never be able to login.

2: The system will throw some kind of error to let us know of a faulty .profile file. (Just a wild guess) Smilie

Please assist.

Thanks in advance.
Avinash
# 2  
Old 06-21-2011
Quote:
Originally Posted by avinashpv
Hi everyone,

This is my first post in the forum. :-)

I was asked this question for an interview recently.

Q: What will happen if the .profile file has only the exit command in it and nothing else.
(Assume that every other settings are in place to run the .profile file, when the user logs in.)

I don't know the answer yet.
I thought of two possible answers :

1: The next time the user tries to login the .profile gets executed and the user will be logged out of the session. In short, the user will never be able to login.

2: The system will throw some kind of error to let us know of a faulty .profile file. (Just a wild guess) Smilie

Please assist.

Thanks in advance.
Avinash

this feels like a homework question.

in any learning I often tell people to try it on a non production system and see what happens.


on any system I have seen I expect it will just log you out.

I have even see sysadmins use this as part of the system security, DONT do that, it not system security.
if you don't want user to login then lock the account.
# 3  
Old 06-21-2011
Hi robsonde,

This is definitely not a homework question :-)
This was asked to me in an interview this weekend.

I was really not sure, if this is going to log me out.
I tried searching the internet for any answer. Also, I was thinking of trying it on a non-production machine. However, I first wanted to have a back-up plan of how I can do damage control, incase the .profile throws me out every time I login.

I think I have the answer now.

Let me try this and find it out for the group.

Thanks for the quick reply though.

- Avinash

---------- Post updated at 03:01 PM ---------- Previous update was at 02:11 PM ----------

I have tried editing the .profile to have only the exit command.
Now the server is not allowing me to login Smilie Smilie

Not sure, how I can fix this. Smilie
# 4  
Old 06-21-2011
Hi i try it on a VM Solaris machine and make a user and write exit in his .profile file in his home directory and reboot, when I log in with this user , it accept and the system works, also I try su command it is works too.

---------- Post updated at 04:55 AM ---------- Previous update was at 04:53 AM ----------

sorry when I log in it is not logging , but su command works .
# 5  
Old 06-21-2011
Quote:
Originally Posted by avinashpv
I first wanted to have a back-up plan of how I can do damage control, incase the .profile throws me out every time I login.
This was a wise approach ...
Quote:
I have tried editing the .profile to have only the exit command.
Now the server is not allowing me to login Smilie Smilie
but not that ...

There are many ways to fix it. For example by using a different account to log in or a protocol that doesn't use .profile like ftp or (probably) sftp.
# 6  
Old 06-21-2011
Sympatico jlliagre Smilie

Do you know telepathy ? :-)

By the way, I was trying multiple things, and it striked me that, if I used SecureFX to overwrite the existing .profile file, it would help me fix this situation.

Thanks guys, for all the quick and effective replies.

I am starting to love this forum.

Will keep coming back !!!

- regards,
Avinash Smilie
# 7  
Old 06-27-2011
my .profile shows the following details.anybody can explain me what does each line does
in UNIX.
TMPDIR=/tmp
ORACLE_HOME=/user2/oracle
ORACLE_SID=TPT
export ORACLE_HOME ORACLE_SID
TK2DEV=cvt100
export TK2DEV
EDITOR=vi
APIPATH=/user2/oracle/rdbms/admin/terminal
ORACLE_OWNER=oracle
PATH=$PATH:/usr/ccs/bin:/usr/ucb:/etc:$ORACLE_HOME:$ORACLE_HOME/bin:/opt/SUNWspro/bin:/user2/oracle/lib:/user2/oracle/sqlreport/admin/terminal:/user8/aglgdr/ent
MANPATH=/opt/SUNWwabi/man:/usr/openwin/share/man:/usr/man:/user8
TERM=vt100
ORACLE_TERM=vt100
MENU5PATH=$ORACLE_HOME/forms30/admin/resource
ORATERMPATH=$ORACLE_HOME/forms30/admin/resource
LD_LIBRARY_PATH=/user2/oracle/lib:/usr/lib
ORAKITPATH=$ORACLE_HOME/sqlreport/admin/terminal
export ORACLE_TERM MENU5PATH ORATERMPATH
export ORACLE_OWNER PATH TERM LD_LIBRARY_PATH ORAKITPATH
export APIPATH EDITOR MANPATH
cd /user8/aglgdr
stty erase 
ksh -o vi
EXINIT='set ai redraw nu showmode'
export EXINIT
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Command Understanding :- . $PWD/.profile

Hi, I am new in unix, can anyone please explain the use of:- . $PWD/.profile Thanks, Sujoy (5 Replies)
Discussion started by: sujoyrchowdhury
5 Replies

2. AIX

Bypass Read Line in profile through AIX command

Hi All, I have a complicated requirement where in I have a "root" user and a user named "xeadmin" I want to take sudo of "xeadmin" by command sudo su - xeadmin. Later i need to hit 2 enter keys as there are 2 read line commands inserted in profile of "xeadmin" and I reach command prompt, i need... (1 Reply)
Discussion started by: hiteshsathawane
1 Replies

3. UNIX for Advanced & Expert Users

Equivalents of tee command to find exit status of command

Hi, Want to log the output of command & check the exit status to find whether it succeeded or failed. > ls abc ls: abc: No such file or directory > echo $? 1 > ls abc 2>&1 | tee log ls: abc: No such file or directory > echo $? 0 Tee commands changes my exit status to be always... (7 Replies)
Discussion started by: vibhor_agarwali
7 Replies

4. UNIX for Dummies Questions & Answers

alias command within .profile

Please could someone advise me the command - to set up aliases commands within a .profile using shell sh regards venhart (13 Replies)
Discussion started by: venhart
13 Replies

5. OS X (Apple)

Problem using a top command alias in my profile

Hi- I am newish to the mac osx unix interface. I want to set up top so that it always displays the username. I can use this command to do this: top -ocpu -P ' PID COMMAND %CPU TIME #TH #PRTS #MREGS RPRVT RSHRD RSIZE VSIZE USER' -p '$aaaa ^bbbbbbbbb $cccc $wwwwwww $ee... (1 Reply)
Discussion started by: mikey11415
1 Replies

6. UNIX for Dummies Questions & Answers

Problem with exit command

Problem with exit command ----------------------------------------------------------------------- Hi, I am executing script written by other user. I am executing script A.ksh, and A.ksh calls B.ksh. But It is giving error: /home/user/B.ksh: exit: -1: unknown option When I checked... (3 Replies)
Discussion started by: shreyas
3 Replies

7. Solaris

/etc/profile file edited. No command working

I have X4500 and I created a user. I wanted to give him root privileges and for editing the sudoers files I typed visudo sudoers. But it said visudo command not found. After googling I found that we need to set path in etc/profile. I edited that and put the following command ... (3 Replies)
Discussion started by: bharu_sri
3 Replies

8. UNIX for Dummies Questions & Answers

exit command

Hi All, Having just started using Unix after a long time on VMS, I end up having multiple Unix and VMS sessions open. Is there a way I can set up a symbol or something so that "lo" means "exit" and exits my session ? On VMS, if I wanted to do the opposite of this I would do it like this : ... (3 Replies)
Discussion started by: cdines
3 Replies

9. OS X (Apple)

creating a new profile from command line

Does any1 know how to preform such an operation on a mac? any help appreciated (2 Replies)
Discussion started by: cleansing_flame
2 Replies

10. Shell Programming and Scripting

profile script command syntax

Following is my /etc/profile script. Everything above the asterisks executes as expected. Nothing below the asterisks executes as I would like it to. Any guidance on what I'm doing wrong would be greatly appreciated :-) #ident "@(#)profile 1.18 98/10/03 SMI" /* SVr4.0 1.3 */ # The... (3 Replies)
Discussion started by: Mufasa
3 Replies
Login or Register to Ask a Question