Linux Mint

How to Disable the sudo Password in Linux Mint 21

sudo (Super User Do) allows us to execute the system commands with root privileges. Whenever you execute any command in the terminal with sudo it will ask you to enter your account password. This is added as a prefix to the commands that only superusers can run and are executed with proper authentication. But there is a way for running the sudo commands without the root account password, it is only recommended if you are the only user on your system otherwise it will risk your Linux Mint security.

How to Disable the sudo Password in Linux Mint 21

Every time you use the sudo command the system will ask for the password before executing the command. If we run the simple update command then it will ask for the password as shown below:

sudo apt update

You can configure the sudo to never ask for your password by following the below given steps:

In the terminal type the following command to access the sudoers file:

sudo visudo

A file will open, in the bottom of the file look for includedir /etc/sudoers.d and add the below given lines at the end, replace the <username> with your own username on your system:

@includedir /etc/sudoers.d

<username> ALL=(ALL) NOPASSWD:ALL

Save and close the file, after making these changes you can execute the sudo command in the terminal without prompting with a password. Confirm the saved changes by executing the system update command with sudo privileges:

sudo apt update

Note: These changes are only for the terminal, you still have to enter the password while installing the tools from the Software Manager.

How to Re-enable the sudo Password in Linux Mint 21

If you ever want to re-enable the sudo password in the terminal you can again edit the sudoers files and remove the lines you have added at the end of the file.

Bottom Line

Enabling and disabling the sudo password in Linux Mint 21 is simple as you just have to make a few changes in the sudoers file. These changes will now stop you from being asked for your password for all the commands running in the terminal.

About the author

Zainab Rehman

I'm an author by profession. My interest in the internet world motivates me to write for Linux Hint and I'm here to share my knowledge with others.