Edit your box's sudoers
file. In a terminal run sudo visudo
. visudo
does a good job of limiting the damage that can be done by manual edits. Adding the following lines, replacing bob
with the correct username. Running the above command with sudo
requires the current user's password.
Cmnd_Alias SHUTDOWN_CMDS = /sbin/poweroff, /sbin/halt, /sbin/reboot
bob ALL=(ALL) NOPASSWD: SHUTDOWN_CMDS
If your system is not connected to the Internet in anyway, an alteritive is to change the line sudo ALL=(ALL) ALL
to sudo ALL=(ALL) NOPASSWD: ALL
. If connected to the internet this is risky.
The sudoers
file alters sudo
permissions to allow a specified user or group to run specific commands. In this case bob can run various shutdown commands without a password.
The /etc/sudoers
file controls who can run what commands as what
users on what machines and can also control special things such as
whether you need a password for particular commands. The file is
composed of aliases (basically variables) and user specifications
(which control who can run what).
- Ubuntu Community Wiki -
Sudoers.