Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
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.
/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:
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...
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??
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...
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.