LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   shutdown command (https://www.linuxquestions.org/questions/linux-software-2/shutdown-command-157908/)

mikedelo 03-15-2004 07:51 AM

shutdown command
 
How do you give other users rights to shutting down the system using the following command: 'shutdown -h now'? Right now, I have to log in as root and shut it down, but I would like to give rights to my users (family). I currently use RH Fedora.

Thank you,
Michael R. DeLorenzo

Komakino 03-15-2004 07:55 AM

/sbin/halt does the same thing. You can get it so anyone can run it by changing it suid root (which means it always runs as root, nomatter who runs it). Do that by typing:
Code:

chmod +s /sbin/halt

Bruce Hill 03-15-2004 07:57 AM

Shutdown is meant to be run by root, which tells all other users and procs that the system is going down. Read ->
$ man shutdown
I don't know if a user could execute it, and don't think one should, but...

Komakino 03-15-2004 08:00 AM

If he knows that his family are the only other users on the computer then setting /sbin/shutdown or /sbin/halt to run suid root shouldn't be an issue.

Bruce Hill 03-15-2004 08:02 AM

I'm a purist. If I want to manipulate the box to work wacky, I'll go back to Mirco$loth
and always "login as root," so to speak. :}

Komakino 03-15-2004 08:03 AM

So you suggest his family either have to ask him to shutdown the computer for them, meaning they can't turn it off if he's not present, or just press the power button? So, without them being able to run 'shutdown' how do you propose they switch the machine off??

andrewlkho 03-15-2004 08:28 AM

You shouldn't alter the permissions on the shutdown script - it's in the sbin directory, so it should keep those permissions. Instead, what you should do is use sudo to allow them to run this command...

bulzbb 03-15-2004 08:37 AM

Hi, hope this help.

If you have sudo installed, then you can add users (or groups) in /etc/sudoers

You can add something like:
#to give a group the right to shutdown
%group_name localhost=/sbin/shutdown -h now
#to give a user the right to shutdown
user_name localhost=/sbin/shutdown -h now

The user then need to execute sudo followed by the command. When asked for a password, it's their own password (not the root). check man sudo too.

Cheers :)


All times are GMT -5. The time now is 10:02 PM.