C-NET :: PROJECTS

cat sudo-without-a-password.md

sudo without a password

Posted
Updated
Filed under
Linux · Reference

Note

Note, this is not something I recommend doing. In fact, the only reason why I'm documenting it is that I am removing this solution from the last box I used to have it on.

Anyway, edit the /etc/sudoers file (with visudo, as root), then add lines under the default one for root, like this:

# User privilege specification
root	ALL=(ALL) ALL
bolt    ALL=(ALL) ALL
bolt    ALL=NOPASSWD: ALL
text

(replace "bolt" with your own username)

If you would rather want to not type a password only for specific commands, specify them like this:

bolt	ALL=NOPASSWD: /sbin/shutdown, /bin/mount, /bin/umount
text

(replacing the username and commands with the ones you want)

Comments