profile (166 Views)
Reply
Regular Advisor
Indrajit Bhagat
Posts: 319
Registered: ‎07-22-2006
Message 1 of 6 (166 Views)

profile

hi all
how can we place a shutdown command in the user's .profile so that she can't do anything else.
Honored Contributor
Victor Fridyev
Posts: 937
Registered: ‎07-01-1998
Message 2 of 6 (166 Views)

Re: profile

Hi,

Define it as the user's shell in /etc/passwd file.

HTH
Entities are not to be multiplied beyond necessity - RTFM
Acclaimed Contributor
James R. Ferguson
Posts: 21,184
Registered: ‎07-06-2000
Message 3 of 6 (166 Views)

Re: profile

Hi:

The easiest way is to declare '/usr/sbin/shutdown -r y' as the program to use as the shell (i.e. the last field of the '/etc/passwd' record for the user in question.

Then, specify the user in '/etc/shutdown.allow' to enable his/her use of the command. Your modified '/etc/shutdown.allow' should look something like:

serverhostname root
serverhostname indrajit

See the manpages for 'shutdown(1M)' for additional information.

Given this setup, when your user logs into your server, it is shutdown.

Regards!

...JRF...
Acclaimed Contributor
James R. Ferguson
Posts: 21,184
Registered: ‎07-06-2000
Message 4 of 6 (166 Views)

Re: profile

Hi (again):

Correction. The 'passwd' entry should read simply:

/sbin/shutdown

in lieu of somethign like '/usr/bin/sh'.

Regards!

...JRF...

Acclaimed Contributor
James R. Ferguson
Posts: 21,184
Registered: ‎07-06-2000
Message 5 of 6 (166 Views)

Re: profile

Hi (again):

How did I *not* answer your question? Would you like a different method?

Regards!

...JRF...
Honored Contributor
AwadheshPandey
Posts: 737
Registered: ‎09-18-2005
Message 6 of 6 (166 Views)

Re: profile

ok, alternate method is edit users id to 0 (root)and place shutdown command to users .profile
It's kind of fun to do the impossible
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.