“Password Less” Sudo

Linux

A quick example on Ubuntu Linux 22.04 LTS. I had the need for a particular user to have “passwordless” sudo ability. Its not best practice to do this, however if you are restricting the command or commands that a user can run with “passwordless sudo”, you are balancing functionality and security as well as you can.

Adding the line to /etc/sudoers is simple, however you must ensure that it is placed at the end of the file, essentially the configuration that sticks is the last read in the file for that particular user.

You edit the file with “visudo”, don’t try to edit the file directly “visudo” ensures you have correct syntax applied etc.

All you need to do is add the following line to the end of the /etc/sudoers file.

ubuntu  ALL=(ALL:ALL) NOPASSWD:ALL

Log out that user and then login again, when running sudo you shouldn’t be prompted for a password.

Leave a Reply

Your email address will not be published. Required fields are marked *