| View previous topic :: View next topic |
| Author |
Message |
m@o Apprentice


Joined: 25 Nov 2003 Posts: 171 Location: /eu/at/grz
|
Posted: Sun Jan 25, 2004 2:01 pm Post subject: [HOW TO] halt, reboot, shutdown as ordinary user |
|
|
i searched the web for a while to get this done and i
found 4 methods:
the first and best method is as follows:
| Code: | # emerge sudo
# visudo
or
# nano -w /etc/sudoers |
add these lines to this file:
| Code: | yourusername ALL=(root)NOPASSWD:/sbin/halt
yourusername ALL=(root)NOPASSWD:/sbin/reboot
yourusername ALL=(root)NOPASSWD:/sbin/shutdown |
or if you want to give a whole group the permission
to halt the computer:
| Code: | %groupname ALL=(root)NOPASSWD:/sbin/halt
%groupname ALL=(root)NOPASSWD:/sbin/reboot
%groupname ALL=(root)NOPASSWD:/sbin/shutdown |
after that you should add a little bash script to your
/usr/local/bin/ folder:
| Code: | #!/bin/bash
sudo /sbin/halt |
name it 'halt' and don't forget to make it executable
| Code: | | # chmod 755 /usr/local/bin/halt |
do the same for reboot and shutdown too.
the second method is the following:
!!! this method is NOT increasing the security of your system !!!
add a sticky bit to /sbin/halt
| Code: | | # chmod a+s /sbin/halt |
to halt as user just do:
do scripts as described above. but of course without sudo!
the third method is to solve it over groups:
| Code: | # groupadd shutdown
# usermod -G shutdown,users $USER
# chgrp shutdown /sbin/halt
# chmod 750 /sbin/halt
# chgrp shutdown /sbin/reboot
# chmod 750 /sbin/reboot
# chgrp shutdown /sbin/shutdown
# chmod 750 /sbin/shutdown |
the fourth method is the weakest:
change the following line in /etc/initab:
| Code: | | ca:12345:ctrlaltdel:/sbin/shutdown -r now |
take away the -r and replace it with an -h
| Code: | | ca:12345:ctrlaltdel:/sbin/shutdown -h now |
then the Ctrl+Alt+del key shortcut should halt your machine.
i'm using the first version, because i think its the most secure one.
and it really works fine for me.
have fun
m@o
references and other posts to this target:
http://forums.gentoo.org/viewtopic.php?t=19791
http://forums.gentoo.org/viewtopic.php?t=28143
http://forums.gentoo.org/viewtopic.php?t=28510
http://forums.gentoo.org/viewtopic.php?t=6253
http://forums.gentoo.org/viewtopic.php?t=1401
Last edited by m@o on Wed Feb 15, 2006 2:29 pm; edited 1 time in total |
|
| Back to top |
|
 |
ank Apprentice


Joined: 06 Aug 2003 Posts: 185 Location: Maribor, Slovenia
|
Posted: Sat Jan 31, 2004 8:43 pm Post subject: |
|
|
Mayby is a dumb question and i shuld already know the answer: What to do if you wish that ctrl+ald+del do nothing?
Now it close all program except X-windows and xfce and i dont like that.
Is it enough if i just edit the line to:
ca:12345:ctrlaltdel:
Sorry!
Me bad
I shuld use google first next time, before asking dumb question:
http://www.dslreports.com/faq/4033 |
|
| Back to top |
|
 |
ett_gramse_nap Apprentice


Joined: 01 Oct 2003 Posts: 252 Location: Göteborg, Sweden
|
Posted: Sun Feb 01, 2004 8:11 pm Post subject: |
|
|
Thanks a lot! _________________ Don't bother! |
|
| Back to top |
|
 |
SaFrOuT Apprentice


Joined: 08 Jul 2003 Posts: 256 Location: Egypt
|
Posted: Sun Feb 01, 2004 10:54 pm Post subject: |
|
|
thanx alot
i really needed this Tip very much |
|
| Back to top |
|
 |
aamonten n00b

Joined: 27 Aug 2003 Posts: 72 Location: Chile
|
Posted: Thu Feb 05, 2004 3:05 am Post subject: |
|
|
| I prefer the third method |
|
| Back to top |
|
 |
v912485 n00b

Joined: 05 Feb 2004 Posts: 26 Location: London, UK
|
Posted: Thu Feb 05, 2004 9:50 pm Post subject: |
|
|
| How about adding a pam solution? |
|
| Back to top |
|
 |
ezman n00b


Joined: 22 Jan 2004 Posts: 9 Location: NorthWestern U.S.
|
Posted: Sun Mar 07, 2004 7:07 pm Post subject: |
|
|
I made my users able to use poweroff and reboot by issuing the following
| Code: | #ln -s /sbin/poweroff /bin/poweroff
#ln -s /sbin/reboot /bin/reboot |
its a quick and dirty method but works for now.
I will however try the first method mentioned using sudo. _________________ Happy Gentoo Convert  |
|
| Back to top |
|
 |
|