Poweroff as user
Quick Question:
How do I use the poweroff command in user mode (not su)? thanks! Mords |
You'd have to sudo it if you aren't su. It requires kernel permission levels that users simply don't have.
That said, I just push the power button on my computer. On both my laptop and my desktop, the kernel intercepts that button push and shuts down properly. I have no reason to suspect that it wouldn't work for you, either. |
The best way to give the users power like that would be to give them permissions to execute shutdown using sudo.
Use visudo to edit the rules file, you should put a line like: Code:
youruser yourmachinename= NOPASSWD: /sbin/shutdown -h now Code:
%users yourmachinename= NOPASSWD: /sbin/shutdown -h now The the users would use: sudo /sbin/shutdown -h now killerbob, unfortunatly, not all the machines behave like that :/ |
Murdock, hope you don't mind me posting this question on your thread!
How do you use visudo? I can't seem to change the file and uncomment the line I need (same one as Murdock tbh). |
Visudo is actually vi, so you've to learn how to use vi.
Basically when you enter your are in "read-mode". Try moving with the arrows, if you can't, use h,j,k,l to move the cursor. Place at the character you want to remove (the #) and press x to delete the character. If you need to input some text, press the i key, type what you want and go back to read mode using ESC key. To save press Code:
:wq Edit: Here's a quick intro manual, http://www.macdevcenter.com/pub/a/ma.../vi_intro.html If you want to go deeper be sure to have installed vim. Copy the file /usr/share/vim/vim63/vimrc_example.vim to ~/.vimrc and run the program, vimtutor |
Thanks! Edit: God I hate vi ;).
|
Alternatively, change the permissions on /sbin/shutdown /sbin/halt and /sbin/reboot to enable users to issue the commands.
|
Quote:
EDIT: Seems like this entry would work as well. username ALL = /sbin/shutdown |
I only type 'halt' as user.
But i can't remember if i had to change some permissions (maybe group). |
It doesn't seem to work. I uncommented the line starting with "%users", but I still can't shutdown as a normal user :/.
|
Are you in the users group? Are you typing 'sudo /sbin/shutdown -h now'?
Jacob |
OH, I didn't realise you had to type "sudo" as well. Does anyone know how to get Xfce to work with this?
|
Add a entry on the menu with that command :)
|
To use the xfce shutdown button, you'll need to visudo and add
Code:
%users ALL=(root) NOPASSWD: /usr/libexec/xfsm-shutdown-helper Jacob |
Nice one, thanks. Quick question though: why is it that you have to use visudo to edit the sudoers file, instead of being able to edit the file directly, like you can with fstab for example?
|
Quote:
|
XavierP:
Changing the permissions didn't work for me, because at least in my kernel (2.4.40), you need kernel permissions for those commands. Thanks! |
shutdown problem
[QUOTE=shotwellj;1788000]To use the xfce shutdown button, you'll need to visudo and add
Code:
%users ALL=(root) NOPASSWD: /usr/libexec/xfsm-shutdown-helper i can not shutdown my computer from xfce (root).i add "%users ALL=(root) NOPASSWD: /usr/libexec/xfsm-shutdown-helper" to my sudoers file but it doesn't work yet !! what can i do? |
Good answer but this thread is almost 2 years old and, as such, dead. I have closed this thread to save it being resurrected further.
|
All times are GMT -5. The time now is 05:08 AM. |