Test Test How to change the sudo password timeout | Çınar Mert Çeçen - Blog
Skip to content
Go back

How to change the sudo password timeout

By default, sudo remembers your password for 15 minutes (on most distributions) before it asks you for it again. If you find this annoying, you can change this to something else by following this guide.

one should NEVER open the /etc/sudoers file with a normal text editor. always use sudo visudo.

  1. Open the /etc/sudoers file by running:
sudo visudo
  1. Append the following line to the end of the file, replacing 30 with the number of minutes you want as your timeout.
Defaults timestamp_timeout=30

Note that if you set it to 0 it will ask for a password every time, and if you set it to -1 it will make the session last forever (until you log out/reboot)


you might also want to show asterisks when typing your password like so:

cinar@fedora ~$ sudo -v
[sudo] password for cinar: *************

or you might want to insult users who mistype their password or even make the lecture text always show up. in either case, click the relevant link.


Share this post on:

Next Post
How to show asterisks when typing sudo password