How to make sudo and gksudo remember your password

Doing system level commands on the terminal can be annoying if you’re constantly bugged by the password prompt. Its a security measure, but if you are just using it solely for desktop / work and you don’t lend your machine, then having some patch for this is necessary.

If you don’t want to be asked for password every time you use the terminal, say for example when you sudo apt-get the system, the trick is just edit the sudoers file. This should also work for gksudo, the graphical version of the password prompt.

Do this by tackling the file /etc/sudoers

sudo visudo

Then find this

Defaults !lecture,tty_tickets,!fqdn

change into

Defaults !lecture,!tty_tickets,!fqdn

you can also add

%username ALL=(ALL) NOPASSWD:ALL

%username corresponds to your logged user name. At first you need to issue your password to perform this. But consequently you wont get any password prompts any more.

This is not recommended for secure or server related Linux distribution, only for your own personal use.

Leave a Reply

Your email address will not be published. Required fields are marked *