In ubuntu, we can use Sudo command without a password to be entered. You have noticed that whenever we use Sudo commands like “sudo apt-get update” or “sudo apt-get install“, We have to enter the password to install any package or update the system.
In this article, you will get to know how to use sudo command without password in ubuntu. There are many more tricks of Ubuntu like add sticky notes, add net speed indicators, etc. You can check that blog in Linux Category.
What is the Use of Sudo Command?
The sudo command allows you to run programs with the security privileges of another user (by default, as the superuser). It prompts you for the password and confirms your request to execute a command by checking a file, called sudoers, which the system administrator configures. Follow the below step to use sudo command without password in ubuntu.
Steps to Use Sudo Command Without Password In Ubuntu:-
(1) Open Terminal and type any sudo command and see whether it is asking for a password or not.
(2) Type the below command in the terminal and Enter the Password of the System.
Also Read: How to Change Application Icon in Ubuntu
What is visudo?
visudo is a tool for updating the sudoers file located in /etc/sudoers, found in most Linux systems (for example, Ubuntu). This file is for allowing regular users to run commands with superuser privileges – using sudo command. The sudoers file opens in either nano or vim editor.
(3) Now You will see sudoers file is open in the Terminal. We have to edit this sudoers File.
(4) Now press the down key in the Keyboard to go the end of the file. Add the below code at the end of this file.
<Sytem_Username> ALL=(ALL) NOPASSWD: ALL
Example:- amit ALL=(ALL) NOPASSWD: ALL
Where “amit” is the username of the system.
Also Read: How to show Hardware temperature on Ubuntu
(5) After adding the above code, save and exit the file. Press Ctrl + X and then hit Y to save and exit the file.
Also Read: How to Split Terminal in Ubuntu 2020
(6) Now close all Terminal and open new Terminal and type sudo command. You will see now sudo command is not asking for any password.