Running a command on login.
I once used a Solaris machine that had a special user. The account username was 'shutdown' and the password was 'system.' If you guessed that this user was solely created as a means to allow quick system shutdown by those privy to this info, then you are absolutely correct.
I'm sure that Linux (Red Hat Enterprise Linux 3.0) can do this as well but I have no idea on how to go about it - anyone willing to lend a hand? Thanks. |
This might give you some hints .
|
A possible approach (not tested):
1. create the user shutdown useradd shutdown 2. allow user to run init sudo -u shutdown init 3. create script /home/shutdown/shutdown.sh #!/bin/sh # prevent cancellation of execution. trap "" 1 2 3 6; # shutdown init 6 for reboot; init 0; 5. change permission for script. chmod 700 /home/shutdown/shutdown.sh 4. change the user "shutdown" line in /etc/passwd from: shutdown:x:501:501:shutdown_user:/home/shutdown:/bin/bash to: shutdown:x:501:501:shutdown_user:/home/shutdown:/home/shutdown/shutdown.sh login as user shutdown and it must shutdown the PC. Hope this help, I didn't test it so beware it might not work exactly as it is, but I think it is a good start. Regards |
If you need to rapidly shutdown your system, why not just
Code:
su |
Why not just grant normal users the right to shut down the computer by using sudo?
You could create a shutdown group, and any user in the group could shut down the system with: Code:
sudo /sbin/shutdown -h now |
Why not use or create the shutdown.allow file?
From the man page of shutdown: Code:
ACCESS CONTROL |
Thanks y'all. Carlosruiz has what I was looking for. Haven't tried it yet, but should it need any tweaking, I should be able to make it work.
Thanks again for all suggestions. I like the sudo ... solution as well so should tweaking carlosruiz's suggestion not work right, I'll try the sudo thing. |
All times are GMT -5. The time now is 05:28 PM. |