How to Configure Sudo to run Without Password or Password-less
If you are using a Linux system in your home which does not need much security or you know there is no threat if you allow to run the sudo command without any password, then this guide will be helpful for you. Before doing this, let’s just understand few basics in the next sections.
What is sudo?
As a root user or super user, 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 a 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 Super User. 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-
- Sudo has a configuration file also known as 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 –
- Now find a line that contains
#includedir /etc/sudoers.dProbably you will find it at the bottom of this configuration file.
Now below the
#includedir /etc/sudoers.dadd 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
- 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 that 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. Now once you save the changes and execute a command with sudo it will again start asking for the password.
I hope you like this article. If you have a query or a suggestion regarding this topic you can write to us in the comment below.
You might also like
This post was last updated on March 1st, 2020 at 02:05 amIn a product development environment in big organizations or projects like Linux kernel development where many developers work on
This post was last updated on November 6th, 2016 at 12:32 amVnc server and vnc viewer is used to Remote Access in most of the Linux machines like Fedora, RHEL,
Contents1 Introduction to firewall1.1 Network firewall –1.2 Host-based firewall –2 How does a firewall work?3 Uncomplicated Firewall(ufw)3.1 How to use ufw –4 GUI tools to configure a firewall Introduction to