View previous topic :: View next topic |
Author |
Message |
olias2 Apprentice
Joined: 23 Aug 2003 Posts: 234 Location: CANADA
|
Posted: Fri Dec 05, 2003 2:51 am Post subject: 'poweroff' as user |
|
|
The 'poweroff' command works great as root but as user I get ... Code: | -bash: poweroff: command not found | I tried putting this in my user .bashrc Code: | alias poweroff='/sbin/shudown -h now' | Any ideas?
Thanks, olias _________________ A wise man realizes that he too is a fool and then humbles himself to learn that which is greater than he. |
|
Back to top |
|
|
meowsqueak Veteran
Joined: 26 Aug 2003 Posts: 1549 Location: New Zealand
|
Posted: Fri Dec 05, 2003 3:53 am Post subject: |
|
|
You need to either be root, or have 'shutdown' suid root, I think. |
|
Back to top |
|
|
Andersson Guru
Joined: 12 Jul 2003 Posts: 525 Location: Göteborg, Sweden
|
Posted: Fri Dec 05, 2003 1:40 pm Post subject: |
|
|
You can also change ctrl-alt-delete to shutdown instead of rebooting. It's very convenient if you don't reboot often. This is done in the file /etc/inittab (just replace reboot what it says with this)
Code: | # What to do at the "Three Finger Salute".
ca:12345:ctrlaltdel:/sbin/shutdown -ha now |
|
|
Back to top |
|
|
modified_bessel Tux's lil' helper
Joined: 16 Jul 2004 Posts: 101 Location: Cote d'Azur, France
|
Posted: Fri Jul 16, 2004 9:23 am Post subject: |
|
|
Try setting permissions of /sbin/poweroff, as root, as follows:
Code: | chmod 4755 /sbin/poweroff |
then at a (quailfied) user prompt, /sbin/poweroff shuts the system down. Also useful for binaries telinit, shutdown, and reboot ! |
|
Back to top |
|
|
boroshan l33t
Joined: 16 Apr 2003 Posts: 730 Location: upside down
|
Posted: Fri Jul 16, 2004 9:36 am Post subject: How about sudo? |
|
|
Code: | alias shutdown="sudo shutdown -h now" |
You can use visudo to allow normal users use sudo with shutdown without requiring a password. Personally, I perfer to leave itprompting m for my password. It's useful for when I type
while half asleep, only to have the shell history mechanism pickup "shutdown". If it prompts for a password, I get a chance to Control-C out of it _________________ Don't let THEM immanentize the Eschaton! |
|
Back to top |
|
|
meowsqueak Veteran
Joined: 26 Aug 2003 Posts: 1549 Location: New Zealand
|
Posted: Fri Jul 16, 2004 11:46 am Post subject: |
|
|
You can also configure sudo to allow certain commands to run without a password - useful for shutting down your PC with a remote control.
See 'man sudoers' |
|
Back to top |
|
|
|