How do I make a User login shutdown my box?
Anthony E. Greene
tony at greene-family.org
Mon Sep 27 13:26:27 UTC 2004
On 14:53 Sep 27, 2004 "Stuart Halliday" <StuartH at ecs-tech.com> wrote:
>
> > How about using sudo. Write a simple shell script to call sudo
> > shutdown then grant the sleep user access to this command with the
> > NOPASSWD option in the sudoers file.
>
> Thanks Stuart that did it. Much appreciated.
> I'd never heard of sudo before.
>
> To help others who may also enquire in the future, here is what I did.
>
> I altered the /etc/passwd file so that the bash shell would be run
> when this user 'sleep' logs in.
> I gave the user 'sleep' in /etc/sudoers permission to run the
> poweroff command with no password.
> and I added the line in .bashrc:
>
> sudo /sbin/poweroff -i
A better solution would be to add the appropriate managers to a group that
is allowed to run poweroff. Then you would be able to see exactly who was
powering off the machine and you would not have to worry about people
managing an additional password.
--Tony
More information about the redhat-list
mailing list