Ubuntu: sudo without password prompt
How many of you are bored of typing your password every time you run a sudo command on your personal computer?! This is a bloody waste of time! I mean, I appreciate the sudoer jazz and the importance of security but then this is my freaking single-owner-only laptop! Why do I need to type password everytime I run a command with a sudo? In fact, if someone has a shell access to my laptop then my biggest worry is ‘where did I lose my laptop?’ more than ‘oh! crap! There is no sudo password!’ Right? How many with me on this one? 🙂
Anyways, so here is my attempt to eradicate password prompt for sudo on my personal laptop. And, it turned out to be super simple! 🙂
Please run this at the command line to edit the sudo list:
$> sudo visudo
The content before I modified is as below:
# # This file MUST be edited with the 'visudo' command as root. # # Please consider adding local content in /etc/sudoers.d/ instead of # directly modifying this file. # # See the man page for details on how to write a sudoers file. # Defaults env_reset Defaults mail_badpass Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" # Host alias specification # User alias specification # Cmnd alias specification # User privilege specification root ALL=(ALL:ALL) ALL # Members of the admin group may gain root privileges %admin ALL=(ALL) ALL # Allow members of group sudo to execute any command %sudo ALL=(ALL:ALL) ALL # See sudoers(5) for more information on "#include" directives: #includedir /etc/sudoers.d
Now, append the following line to the END of the file (if not at the end there is a chance it could be nullified by other entries!):
<username> ALL=NOPASSWD: ALL
In my case, this is:
rp ALL=NOPASSWD: ALL
Save & exit!
To enforce this “no-password-sudo” rule, logout & log back in and Voila you are done! 🙂
Leave a Reply