If you are the only one using your Linux computer, why does he keep asking you for your password? Let’s see how you can use sudo without having to type a password every time.
Note: we will see how to disable the sudo password in the latest version of Ubuntu. The details of the process may be different in other distributions.
Edit the Sudoers file
To deactivate password verification when using sudo for your account, you must modify the “sudoers” file. This is where access rights to
sudo are defined for individual user accounts or user groups. However, it would be best not to try to modify the file directly. Instead, run your preferred terminal and enter:
Disable Sudo password for your account
To prevent sudo from asking you for your password, first check if there is an existing rule with your alias. If so, replace it with what we will see next. If there is none, go to the end of the file and create a new rule there. It should look like:
For my alias, this rule was:
Save the changes and exit the editor. Since in our installation the editor was nano, we used Ctrl + O, followed by Ctrl + X.
Use Sudo without a password
That’s all you have to do – from now on, sudo will no longer ask you for your password, as long as everything goes as planned and no typos thwart our plans. Find out with an order like
sudo apt updateor by installing an application with
sudo apt install as a test, for example:
Do not disable Sudo passwords for everyone
If you share your computer with other people and don’t want them to have to enter their passwords every time they use sudo, don’t do it. In fact, there should only be one primary user with the sudo privilege.
Sudo is no longer considered a security measure against users with local access to our equipment. It is not that difficult to reset the root password if you have local access to a Linux installation. Instead, it’s there for the same reason as annoying Windows user account control: as a final layer of protection between us, our computer, and potential chaos. And this is because an incorrect order can lead to the deletion of all our data, the destruction of our installation or the involuntary sharing of personal information.
Disabling the sudo password is only valid for those who have good Linux command line experience and are the only user on their computer.
It should be noted that this removes this last barrier of protection between a user and his own errors. We strongly suggest that you also make a full backup of your system and all of its data before doing so.
Is this article useful?