1748108 Members
4923 Online
108758 Solutions
New Discussion юеВ

Re: profile

 
Indrajit Bhagat
Regular Advisor

profile

hi all
how can we place a shutdown command in the user's .profile so that she can't do anything else.
5 REPLIES 5
Victor Fridyev
Honored Contributor

Re: profile

Hi,

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

HTH
Entities are not to be multiplied beyond necessity - RTFM
James R. Ferguson
Acclaimed Contributor

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...
James R. Ferguson
Acclaimed Contributor

Re: profile

Hi (again):

Correction. The 'passwd' entry should read simply:

/sbin/shutdown

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

Regards!

...JRF...

James R. Ferguson
Acclaimed Contributor

Re: profile

Hi (again):

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

Regards!

...JRF...
AwadheshPandey
Honored Contributor

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