X
    Categories: Linux

How to run sudo command without password


Its really frustrating to run sudo commands in terminal , since you need to provide password of the respective user for command execution. In this post we will be quickly discussing how to run sudo command without password.


Quick way to run sudo command without password

Step1: Check current user on the terminal using below command:

manmohan@ubuntu:~$ whoami
manmohan
manmohan@ubuntu:~$

In my case we need to configure for manmohan user so that, we can able to run sudo command without password ubuntu.

Step2: Edit the sudo’eres configuration.

Now we need to change sudo configuration.

sudo visudo

and below lines at the end of the file. Please do not forgot to replace manmohan with your username.

manmohan ALL=(ALL) NOPASSWD: ALL

Your terminal will look like this:

Step 3: Save the file.

Now to save the files press ctrl+x. System will ask about the file select /etc/sudoers and enter Y in the confirmation. Thats all now you don’t need to enter password for user manmohan for sudo command.

Step 4: Perform a test to run sudo command without password.

manmohan@ubuntu:~$ sudo service ssh restart
manmohan@ubuntu:~$ 
Related Post