normal user running shutdown
if possible looking for a way to have a normal user be able to run shutdown, and reboot commands. Now since i am root, and user, and the only user i could just use su or something the do the commands if that the easiest way.
any help would be great thanks chris |
man sudo
and take a read of that, if your still stuck, just post back. |
ok thanks, figured it out
so if i am doing this right, i would be typing "su /sbin/shutdown -h now"? if that correct then another question, can i create a script called say "killpc" in pc home bin dir that contains that command line, that would make less typing? im thinking it woud work but what do i know? chris |
No, using su, it would be su -c "/sbin/shutdown -h now"
But you can just press CTRL+ALT+DEL to reboot :) And sudo is not su. with sudo you can specify a user and a given program that the user can run as root wiithout entering a password.. f.e. as root visudo then find the line where is: # User privilege specification root ALL=(ALL) ALL And below that you can add your entry... f.e. allowing user foobar to execute shutdown without passwd: foobar ALL=NOPASSWD:/sbin/shutdown now foobar can just enter "sudo /sbin/shutdown -h now" and he must not enter a passwd.. for lazyness, you could add an alias to your .bashrc or .bash_login, say alias shutdown='sudo /sbin/shutdown -h now' re-login and 'shutdown' |
actualy when i wrote that it was supposed to be a sudo, not su. guess thats what i get for not proofreading eh? :D
thanks though extermely helpful chris |
I find out other way how to do this. You need a "pam" package and "usermode" package, both you can download from dropline http://sourceforge.net/project/showf...group_id=62166 . Install them and you will be able use halt and reboot as user. If you really need shutdown command then do "ln -s consolehelper shutdown", "cp /etc/pam.d/halt /etc/pam.d/shutdown" and "cp /etc/security/console.apps/halt /etc/security/console.apps/shutdown". Then as a user you can try to type "shutdown -h now" :)
|
As for the killpc, you could try make an alias in you ~/.bashrc
(eg: your ~/.bashrc file) Code:
alias killpc='sudo shutdown -h now' Save that in ~/.bashrc, and exit to your CLI Then just Code:
source ~/.bashrc |
All times are GMT -5. The time now is 08:41 AM. |