RT Cunningham

Disable Passwords on Linux

Written on Mar 8, 2026

Tagged: computers, linux

Although it's possible to disable password authentication on Linux, it isn't a good idea to do so permanently. I only disable password authentication when I first install a Linux distribution and when I do extensive testing on a virtual machine. I strongly dislike typing a password a thousand times. As soon as things are set up, I re-enable password authentication.

I'm getting older and slower. Setting things up can sometimes take a lot longer than I expect. Before I start setting up the computer, I go into the UEFI settings and add a power-on password. I never automatically log in to my Linux distribution, even after I remove the power-on password.

Disable Sudo Password Authentication

At the terminal, type:

sudo visudo

Go to the end of the file and enter:

username ALL=(ALL) NOPASSWD: ALL

Replace "username" with your username, of course.

Exit the terminal and when re-entering the terminal, the sudo password will not be required when using sudo as part of a command.

To re-enable sudo password authentication, either remove that line or place "#" in front of it. Exit the terminal and when re-entering the terminal, you will once again have to type a password with sudo as part of a command.

Disable Desktop Interface Password Authentication

At the terminal, type:

sudo -s

Navigate to:

/etc/polkit-1/rules.d

Create file:

disable.rules

Add this and save:

polkit.addRule(function(action, subject) {
return polkit.Result.YES;
});

Log out and log back in, and the next time you use the desktop interface to install or remove software or make changes, no password will be required.

To re-enable password authentication, remove that file, or place "#" at the front of each line. Again, log out and log back in.