create user to shutdown system
Hello .
Excuse me for bad English ! I need create user . when user login --> system go to shutdown . I create this script : Code:
### Shutdown Script ### Code:
-rwsr-xr-x. 1 root root 48 Dec 5 17:54 /usr/local/sbin/sholt Code:
useradd -s /usr/local/sbin/sholt sysoff Code:
sysoff:x:501:501::/home/sysoff:/usr/local/sbin/sholt |
Quote:
Code:
sudo /sbin/shutdown -h now |
1. add the user in the sudoers file to allow him to shutdown the machine which typically only super users can do.
Code:
# echo "sysoff ALL=NOPASSWD: /sbin/shutdown -h now" >> /etc/sudoers Code:
$ sudo /sbin/shutdown -h now |
thank you for answer .
I need auto shutdown system after login . Code:
Login : sysoff |
3. login as sysoff and then run the following command:
Code:
$ echo "sudo /sbin/shutdown -h now" >> ~/.bash_profile |
ooooooo !
Ok ! this script now work . :) Thank you . |
Good Morning:
This is exactly what I have for a shutdown script: !#/bin/bash sudo /sbin/shutdown -h now Saved as Shutdown.sh #whoami root #ls -l -rwxr-xr-x 1 root root Shutdown.sh #Shutdown.sh bash: Shutdown.sh: command not found What am I doing wrong? Thank you in advance for the assistance. |
If I click the Shutdown.sh on the desktop it works. But if I run it in Bash it does not execute and errors out.
Thanks for the feedback. |
Quote:
Also, DON'T hijack someone elses thread with your question. Open your own thread for your own question. |
Thanks and I won't again.
|
All times are GMT -5. The time now is 08:00 PM. |