The .profile file has only exit command

Hi everyone,

This is my first post in the forum. :slight_smile:

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) :o

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.

Hi robsonde,

This is definitely not a homework question :slight_smile:
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 :frowning: :confused:

Not sure, how I can fix this. :wall:

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 .

This was a wise approach ...

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.

Sympatico jlliagre :wink:

Do you know telepathy ? :slight_smile:

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 :b:

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