How to Configure Sudo to run Without Password or Password-less
 

How to Configure Sudo to run Without Password or Password-less

 

This post was last updated on August 2nd, 2020 at 11:21 am

If you are using the Linux operating system in your system which does not need much security or you know there is no threat if you allow running the sudo command without any password, then this guide will be helpful for you. Before doing this, let’s just understand a few basic things in the next sections.

What is sudo

As a root user or superuser, you are permitted to do anything like executing a program, editing a configuration file, etc. However, if you are a normal user you will be restricted with such permissions. To perform tasks like installation or removal of a package or editing a configuration file you need to have the superuser’s privilege. You can execute a command with superuser privileges by using sudo.

Sudo is a computer program in Unix or BSD operating systems. It allows a user to run a program with the security privileges of the superuser. For security purposes, it does logging of each command and argument which can be used later to see who did what?

How to configure to run sudo without password or passwordless

When you execute a command with sudo it will prompt for the user password. Once you enter the password and press the return key that command will get executed. This requirement of the password can be removed for a specific user by using the following steps-

  1. Sudo has a configuration file also known as the sudoers file which is typically located at /etc/sudoers. Edit the sudo’s configuration file by using the following command –
    sudo nano /etc/sudoers

    This command will prompt for the password once you enter and press the return key it will open the sudo configuration file in the terminal by using the nano text editor. The configuration file of sudo will look something like this –

  2. Now find a line that contains #includedir /etc/sudoers.d Probably you will find it at the bottom of this configuration file.
  3. Now below the #includedir /etc/sudoers.d add the following lines
    username ALL=(ALL) NOPASSWD:ALL

    Replace the username with the username present on the system. In my case, I will add the below line in my system where lalit is the username-

    lalit ALL =(ALL) NOPASSWD:ALL

  4. And finally, save the changes by pressing ctrl+s and then press ctrl+x to exit from the nano text editor. And now you can execute a sudo command without entering the user password.

If you want to configure it for another user you can do this by following all the steps that are given above.

Now if you want a command executing with sudo should ask for the password again, simply open the configuration file using a text editor and remove that line you have added. Once you save the changes and execute a command with sudo it will again start asking for the password.

Previous What Is aptitude And How To Use It?
Next How to Find and Reduce Boot Time in Linux
 

About author

You might also like

Linux Topics 0 Comments

MX Linux vs Manjaro – A Detailed Analysis

This post was last updated on March 1st, 2021 at 01:26 pmHaving so many Linux distros out there, it is difficult for beginners to figure out which one is better

How To 0 Comments

How To Check Current Version Of Ubuntu Using lsb_release Command?

This post was last updated on August 1st, 2020 at 12:40 pmUbuntu comes in two releases the first one is LTS and the second is standard versions. LTS (Long Term

How To 0 Comments

How To Set JAVA_HOME Environment Variable For All Users In Linux?

This post was last updated on August 1st, 2020 at 12:51 pmAn environment variable is a variable whose value is set outside the program, Typically through a functionality built into

0 Comments

No Comments Yet!

You can be first to comment this post!

Leave a Reply