LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 09-23-2009, 11:33 PM   #1
christevensabenz
LQ Newbie
 
Registered: May 2006
Posts: 5

Rep: Reputation: 1
Lightbulb Shutdown without su


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.

Thx & Brgds,
Chris
 
Old 09-23-2009, 11:38 PM   #2
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556
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.

Sasha
 
Old 09-23-2009, 11:38 PM   #3
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
You can always do an "sudo" ;-)
 
Old 09-24-2009, 12:01 AM   #4
mudangel
Member
 
Registered: May 2008
Location: Ohio
Distribution: Slackware
Posts: 267

Rep: Reputation: 56
.one way to do it, anyway...

I usually alter my inittab so Ctrl-Alt-Del shuts it down-
Code:
# What to do at the "Three Finger Salute".
ca::ctrlaltdel:/sbin/shutdown -h now
-so I can use the power button for standby. That's for laptops; for a desktop, if I have to shut it down, I use the power button.
 
Old 09-24-2009, 01:08 AM   #5
andrew.46
Senior Member
 
Registered: Oct 2007
Distribution: Slackware
Posts: 1,365

Rep: Reputation: 493Reputation: 493Reputation: 493Reputation: 493Reputation: 493
Hi Sasha,

Quote:
Originally Posted by GrapefruiTgirl View Post
I always shat down as root...
Do they have modquotes here too?

Andrew
 
Old 09-24-2009, 01:32 AM   #6
cwizardone
LQ Veteran
 
Registered: Feb 2007
Distribution: Slackware64-current with "True Multilib" and KDE4Town.
Posts: 9,097

Rep: Reputation: 7276Reputation: 7276Reputation: 7276Reputation: 7276Reputation: 7276Reputation: 7276Reputation: 7276Reputation: 7276Reputation: 7276Reputation: 7276Reputation: 7276
Quote:
Originally Posted by GrapefruiTgirl View Post
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.
 
Old 09-24-2009, 01:58 AM   #7
vik
Member
 
Registered: Apr 2008
Distribution: Gentoo, FreeBSD
Posts: 225
Blog Entries: 8

Rep: Reputation: 50
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
 
Old 09-24-2009, 02:19 AM   #8
christevensabenz
LQ Newbie
 
Registered: May 2006
Posts: 5

Original Poster
Rep: Reputation: 1
@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.


===
Thanks a lot all... ^_^
/x
 
Old 09-24-2009, 02:28 AM   #9
vik
Member
 
Registered: Apr 2008
Distribution: Gentoo, FreeBSD
Posts: 225
Blog Entries: 8

Rep: Reputation: 50
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
 
Old 09-24-2009, 02:30 AM   #10
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Or you can set the suid bit for /sbin/halt
Code:
chmod +s /sbin/halt
 
Old 09-24-2009, 02:36 AM   #11
egregor
Member
 
Registered: Sep 2009
Distribution: slackware, Salix, bsd's
Posts: 35

Rep: Reputation: 17
Don't forget to create a symbolic link in e.g. /usr/bin/ to /sbin/shutdown (using ln tool), after you set user id (suid).
 
Old 09-24-2009, 04:20 AM   #12
christevensabenz
LQ Newbie
 
Registered: May 2006
Posts: 5

Original Poster
Rep: Reputation: 1
Quote:
Originally Posted by vik View Post
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

/x
 
Old 09-24-2009, 04:57 AM   #13
GazL
LQ Veteran
 
Registered: May 2008
Posts: 6,897

Rep: Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019
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.
 
Old 09-24-2009, 10:19 AM   #14
rrbert
LQ Newbie
 
Registered: Jul 2007
Posts: 11

Rep: Reputation: 1
this works on slackware 12.2

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

then you can just type
sudo /sbin/shutdown -h now

as a normal user
 
Old 09-24-2009, 11:02 AM   #15
gnashley
Amigo developer
 
Registered: Dec 2003
Location: Germany
Distribution: Slackware
Posts: 4,928

Rep: Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612
christevensabenz, notice carefully the syntax -you are using 'user' instead of 'users' and the line should begin with '%'.
 
  


Reply

Tags
poweroff, shutdown, sudo



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
'shutdown' command causing unclean shutdown silentwol Linux - Software 3 07-01-2009 02:01 AM
User shutdown - 'cp -i -p shutdown /usr/sbin/shutdown2 - why does this not work, can? mitchellray Linux - Desktop 4 03-20-2009 09:31 PM
My Linux box does not shutdown i do when i do /sbin/shutdown -h now yawe_frek Linux - Hardware 6 09-14-2007 07:48 AM
Linux full shutdown vs. manual shutdown? LQtoto Linux - General 9 01-26-2005 06:21 PM
konsole shutdown possible? or key combo = shutdown possible? Laptop2250 Linux - Newbie 3 11-16-2003 10:44 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 02:29 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration