Skip to main content
Create a passwordless sudo user

Create new user on Ubuntu, with sudo access without password.

Islam Essam avatar
Written by Islam Essam
Updated over 3 years ago

Sometimes it is helpful to have a user that you can use sudo with - without having to enter the user's password all the time. This approach is not the best when it comes to security, but it is needed sometimes to accomplish certain tasks.

Assuming you connected your server to SimpleBackups, SSH into your server:

ssh user@ip

Create a new user, let's call it simplebackups:

sudo adduser simplebackups

Afterwards, we will copy the authorized keys from the current user to the new user to allow SimpleBackups to continue to connect:

sudo cp -rf ~/.ssh /home/simplebackups/

Finally, we will add the new user, simplebackups to the list of 'sudeors' and allow it to authenticate without a password:

sudo visudo

At the end of the file, add the following line (make sure you add it at the very bottom):

simplebackups ALL=(ALL) NOPASSWD:ALL

Then save and exit

Test to connect via SSH using the new user:

ssh simplebackups@ip

Test using the sudo command and confirm that you are not requested to enter a password.

sudo ls /root

Did this answer your question?