Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
'poweroff' as user
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
olias2
Apprentice
Apprentice


Joined: 23 Aug 2003
Posts: 234
Location: CANADA

PostPosted: Fri Dec 05, 2003 2:51 am    Post subject: 'poweroff' as user Reply with quote

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
View user's profile Send private message
meowsqueak
Veteran
Veteran


Joined: 26 Aug 2003
Posts: 1549
Location: New Zealand

PostPosted: Fri Dec 05, 2003 3:53 am    Post subject: Reply with quote

You need to either be root, or have 'shutdown' suid root, I think.
Back to top
View user's profile Send private message
Andersson
Guru
Guru


Joined: 12 Jul 2003
Posts: 525
Location: Göteborg, Sweden

PostPosted: Fri Dec 05, 2003 1:40 pm    Post subject: Reply with quote

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
View user's profile Send private message
modified_bessel
Tux's lil' helper
Tux's lil' helper


Joined: 16 Jul 2004
Posts: 101
Location: Cote d'Azur, France

PostPosted: Fri Jul 16, 2004 9:23 am    Post subject: Reply with quote

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
View user's profile Send private message
boroshan
l33t
l33t


Joined: 16 Apr 2003
Posts: 730
Location: upside down

PostPosted: Fri Jul 16, 2004 9:36 am    Post subject: How about sudo? Reply with quote

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
Code:
!su
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
View user's profile Send private message
meowsqueak
Veteran
Veteran


Joined: 26 Aug 2003
Posts: 1549
Location: New Zealand

PostPosted: Fri Jul 16, 2004 11:46 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware 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