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)
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.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
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
2. OS X (Apple)
Does any1 know how to preform such an operation on a mac?
any help appreciated (2 Replies)
Discussion started by: cleansing_flame
2 Replies
3. UNIX for Dummies Questions & Answers
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
4. Solaris
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
5. UNIX for Dummies Questions & Answers
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
6. OS X (Apple)
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
7. UNIX for Dummies Questions & Answers
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
8. UNIX for Advanced & Expert Users
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
9. AIX
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
10. UNIX for Beginners Questions & Answers
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