Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
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.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I have multiple users on a desktop system and want them to be able to shutdown the machine. I can't get sudo working, and even that would be overkill; i just want users to be able to shutdown the machine.
Can I somehow change the permissions on /sbin/poweroff to something everyone can use? It's already chmod 777...
Originally posted by servnov
I have multiple users on a desktop system and want them to be able to shutdown the machine. I can't get sudo working, and even that would be overkill; i just want users to be able to shutdown the machine.
Can I somehow change the permissions on /sbin/poweroff to something everyone can use? It's already chmod 777...
poweroff is a symlink to halt that is why you see 777. the real permissions are the ones of halt
Quote:
Originally posted by Chinaman I'll take a gander...what if you add these users to the bin group?
As root issue "vigr" and add whichever users to bin, because of:
Code:
mingdao@james:~$ ls -al /sbin/poweroff
lrwxrwxrwx 1 root root 4 2005-07-21 21:28 /sbin/poweroff -> halt*
mingdao@james:~$ ls -al /sbin/halt
-rwxr-xr-x 1 root bin 8844 2005-07-18 07:48 /sbin/halt*
/sbin/poweroff being a symlink to /sbin/halt.
As you can see from the permissions "others" have "r-x" permissions, so everyone can execute it.
Adding the users to the "bin" group would do good if the permissions were "-rwxr-x---", so it will do no good.
If you run KDM/GDM (graphical login) you can easily setup the login manager so that any local user can reboot/shutdown the pc.
If you run console logins and then startx, then i guess sudo would be a way.
if you read the manpage of "halt" you will see that it runs "shutdown".
in the "shutdown" manpage it is mentioned that it was not written so that it would be run setuid so that every user can run it.
So, i guess the quickest way is sudo, unless i forget something.
I cheated and put a "Shutdown" button on my XDM login screen. Since all apps on the login screen are run as root, this works perfectly without any need for sudo-ing, passwords, chmod-ing or anything else. . .
Here's a Wish script (requires TCL & TK) that I use:
I don't personally run KDE, but am building a box for someone today with it.
I installed Slackware -current and using KDE with runlevel 4 gives 3 choices:
End Current Session
Turn Off Computer
Restart Computer
They all work fine for all users. You might need to enable either APM or ACPI
in the kernel to get the box to actually shut down, rather than hanging at
Power off. I don't know with KDE, because it changes many things "behind
the scenes." I know you do with Fluxbox, the window manager I use on my
workstation. But I compiled a new kernel already for the box, so can't say
how that behavior will work with KDE and a default kernel.
I did this to get it working, as root type what is below,
cd /sbin
chmod 4777 halt
chmod 4777 shutdown
yes. and a user does "cat /bin/bash > /sbin/shutdown"
Instant suid shell (i know that the suid bit is supposed to be turned off but it doesn't happen all the time)
Even if this scheme was a good solution the right command would be
"chmod 4755"
But, let me say again.
"Shutdown wasn't designed to be run setuid."
(From the shutdown manpage)
It doesn't mean that it won't work. It will work ok, but the author mentions that shutdown has not been written with the thought
that it would be run setuid, so they didn't take the measures that are needed from security point of view.
If you don't care about security or you have few/trusted users or whatever then do it.
"cd /sbin
chmod 4755 halt shutdown"
But, I (and the author whose opinion has more weight than mine) don't recommend it.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.