SlackwareThis Forum is for the discussion of Slackware Linux.
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.
Hi Slackers,
If I'm not logged-in as root, how can I shutdown my box without su?
It is not a big deal, but nice to have still.
I've searched the threads, but couldn't find the similar ones.
If you're using Slack 13, and your user is a member of the "Power" group, you should be able to have the option to shutdown, when you log out of your session.
I can't recall if there was a 'Power' group prior to Slack 13, and my memory is fading -- I always shat down as root, so I'm not too sure about that.
Distribution: Slackware64-current with "True Multilib" and KDE4Town.
Posts: 9,097
Rep:
Quote:
Originally Posted by GrapefruiTgirl
If you're using Slack 13, and your user is a member of the "Power" group, you should be able to have the option to shutdown, when you log out of your session...
That's the theory, but it has yet to work, and, yes, my user is in the "power" group.
I assume you mean shutting down from the command line?
The only way I've gotten it to work is to run visudo, and edit the file like this:
under this line:
root ALL=(ALL) ALL
user ALL=/sbin/shutdown, /sbin/halt
or if you want to use the wheel group, do
wheel ALL=/sbin/shutdown,/sbin/halt
@Sasha:
My username is already member of "power" group, yet it is not working.
I'm using 13 now, and "power" group already available in previous Slack's version.
Bash always gives me output "command not found" when I execute "shutdown -h now" or "poweroff", while it works just fine with root/su/sudo.
@paulsm4:
I'm trying to find a shortcut to do this?
@mudangel:
I need to keep Ctrl+Alt+Del to function as reboot, but yes it is one way of another.
@vik:
This seems very promising, I'll try it and tell you the result soon.
you get command not found because normal users don't get /sbin in their PATH environment variable. So you have to explicitly say /sbin/shutdown as a normal user, and just shutdown as root (because /sbin is in root's PATH variable).
If you want to allow anyone in the power group to shutdown the system, do:
power ALL=/sbin/shutdown,/sbin/halt
you get command not found because normal users don't get /sbin in their PATH environment variable. So you have to explicitly say /sbin/shutdown as a normal user, and just shutdown as root (because /sbin is in root's PATH variable).
If you want to allow anyone in the power group to shutdown the system, do:
power ALL=/sbin/shutdown,/sbin/halt
Hi vik,
Not sure where I was wrong, but it doesn't work for me.
Here is the combination of my altered sudoers file, one at a time:
#1 user ALL=/sbin/shutdown,/sbin/halt
#2 power ALL=sbin/shutdown,/sbin/halt
#3 %power ALL=sbin/shutdown,/sbin/halt
#4 user localhost=/sbin/shutdown
#5 user localhost=/sbin/shutdown -h now
#6 power localhost=/sbin/shutdown,/sbin/halt
#7 %power localhost=/sbin/shutdown,/sbin/halt
#8 user ALL=(operator)/sbin/shutdown,/sbin/halt
#9 user localhost=(operator)/sbin/shutdown,/sbin/halt
#10 power ALL=(operator)/sbin/shutdown,/sbin/halt
#11 %power localhost=(operator)/sbin/shutdown,/sbin/halt
#etc...
I don't have all day to chew the man page, which is very long indeed.
Any idea where is my mistake? T_T
If you're sitting next to your case, why not just press the button on the front. It runs shutdown -h for you. This has worked on my box for the past couple of releases.
i have often wanted to do this too, so i just did it and tested it now. what i did is
su to root
cd /etc
visudo
add this line to the end of the file
%users ALL = NOPASSWD: /sbin/shutdown -h now
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.