Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Allow users in group "wheel" to shutdown without s
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
cfaun
n00b
n00b


Joined: 25 Dec 2004
Posts: 63

PostPosted: Sat Jan 08, 2005 8:14 pm    Post subject: Allow users in group "wheel" to shutdown without s Reply with quote

Disclaimer: I will take no responsibility for anything that may go wrong. Use at your own risk and all that legal yadda yadda yadda...

In some distributions, by simply typing the "halt" command as a normal user, you can turn off the computer. Thus can also be done in Gentoo.

The first step is to make sure that the computer actually turns off (as opposed to staying on with a "power down" message) when told to. This may not be possible with newer computers. This is an option that will need to be enabled in the kernel. For instance, in 2.6 kernels, you should enable the following:
Code:

Power management options (ACPI, APM)  --->
     [*] Power Management support
     APM (Advanced Power Management) BIOS Support  --->
          <*> APM (Advanced Power Management) BIOS support
          [*]   Use real mode APM BIOS call to power off


Next, emerge the "sudo" program (be sure to specify the category on this one!):
Code:

emerge app-admin/sudo


Now, as root, type the following commands:
Code:

echo 'sudo /usr/bin/shalt' > /usr/bin/halt
echo '/sbin/shutdown -h now' > shalt
chmod 755 /usr/bin/shalt /usr/bin/halt


Now it is time to edit the sudoers file, by typing the "visudo". Once editing the file, append the following to the end of it and exit your editor:
Code:

%wheel  ALL=NOPASSWD: /usr/bin/shalt


Now, any user in the group "wheel" can run the halt command to shut down the system.

KEYWORDS:
shutdown
turn off

EDIT: fixed BBCode problem
_________________
This sig intentionally left blank
Back to top
View user's profile Send private message
Hobbit_HK
n00b
n00b


Joined: 11 Nov 2004
Posts: 54
Location: Israel

PostPosted: Sun Jan 09, 2005 10:33 am    Post subject: Reply with quote

Hmm.. Nice..
Do you have to enable APM? Can't ACPI do something (I saw on the kernel help doc it was meant to replace APM)?
_________________
- Hobbit HK :)

Don't use stage1\2 tarballs
Do a stage1 install from a stage3 tarball
Back to top
View user's profile Send private message
cfaun
n00b
n00b


Joined: 25 Dec 2004
Posts: 63

PostPosted: Sun Jan 09, 2005 3:34 pm    Post subject: Reply with quote

I don't know...I didn't see anything that could be used under ACPI...
_________________
This sig intentionally left blank
Back to top
View user's profile Send private message
Config
Retired Dev
Retired Dev


Joined: 25 May 2003
Posts: 187
Location: Zurich, Switzerland

PostPosted: Sun Jan 09, 2005 4:17 pm    Post subject: Reply with quote

ACPI overrides APM if enabled. This woks with acpi without a problem. Just for apm, this *might* be required, though I'm not even sure of this
_________________
Config - caught by a chronic disease called tuxmania....
Back to top
View user's profile Send private message
Leffe
Tux's lil' helper
Tux's lil' helper


Joined: 07 Apr 2004
Posts: 145
Location: Sweden

PostPosted: Sun Jan 09, 2005 6:47 pm    Post subject: Reply with quote

I think chowning the shutdown script to root:wheel and chmod it g+x should work too.
Back to top
View user's profile Send private message
crysaz
n00b
n00b


Joined: 10 May 2004
Posts: 13

PostPosted: Mon Feb 14, 2005 8:26 am    Post subject: Reply with quote

still I prefer sudoing

You'll don't have to track all changes, if you deside change security policies.
Back to top
View user's profile Send private message
citizen428
Retired Dev
Retired Dev


Joined: 10 Jun 2002
Posts: 317
Location: Vienna, Austria

PostPosted: Wed Feb 16, 2005 3:25 pm    Post subject: Reply with quote

Hobbit_HK wrote:

Do you have to enable APM? Can't ACPI do something (I saw on the kernel help doc it was meant to replace APM)?

Sure it can. I'm using the same method with ACPI for a long time now.

Have a look at /etc/acpi/events. There you can uncomment the following two lines:
event=button power.*
action=/sbin/init 0
Back to top
View user's profile Send private message
mrsteven
Veteran
Veteran


Joined: 04 Jul 2003
Posts: 1938

PostPosted: Wed Feb 16, 2005 5:16 pm    Post subject: Reply with quote

Yeah, this is really nice. Shutting down using the power button! But remember you must have acpid running to make this work. Another solution especially if ACPI doesn't work would be to change the lines
Code:
# What to do at the "Three Finger Salute".
ca:12345:ctrlaltdel:/sbin/shutdown -r now

in /etc/inittab to
Code:
# What to do at the "Three Finger Salute".
ca:12345:ctrlaltdel:/sbin/shutdown -h now

Now you can shutdown via ctrl+alt+del.8)
_________________
Unix philosophy: "Do one thing and do it well."
systemd: "Do everything and do it wrong."
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum