Am trying allow a specific user, who is in the group
sudo, to perform an emergency shutdown using the following code:
echo 1 > /proc/sys/kernel/sysrq echo o > /proc/sysrq-trigger
Note, this is without using the command
EDIT: Forgot to mention that both files, owned by
root:root, refuse to allow any permission or owner changes, even by the
A hacker compromises a system, which is usually left to run without supervision, and gained permissions to read confidential data. Rather than allowing the hacker to continue, an automated script powers off the machine (assume that the hack has been detected).
While not my exact use case, it is similar enough.
What I Have Tried
Creating a bash script to perform the above 2 lines of code, giving it
root:sudoowners, and adding a line to
visudoto allow the specific user to run the task without needing to enter the password.
Attempted to change the owner of the 2 files to
Attempted to change the permissions of the 2 files such that the group
rootcould write to them.
The idea is to not "bake in" the password for
sudo, which will allow me to change is regularly without forgetting to modify other files (or to have the process which turns off the computer running with
root privileges). Thanks in advance for your help.