17

How do I make sudo remember my password for longer so that I don't have to keep typing it? I do not want to sudo su and execute commands as root all the time.

I am on Arch Linux and have tried to google this but I get examples to change my password, which is not what I'm after.

  • 6
    Point of order, sudo does not "remember your password" so much as it remembers your session -- pam_sudo remembers that you authenticated correctly in that particular console session and retains that flag for passwd_timeout seconds. – Shadur Jul 18 '15 at 9:13
22

There is timestamp_timeout option in your /etc/sudoers. You can set up this option to number of minutes. After that time it will ask for password again. More info in man sudoers.

And make sure you edit your sudoers file using visudo, which checks your syntax and which will not leave you with wrong configuration and inaccessible sudo.

  • 1
    If you rely rely hate passwords, then you can configure sudoers so that you do not need one. You can also do this for just some individual commands / users. – ctrl-alt-delor Jul 18 '15 at 10:09
16

There is a timestamp_timeout option in your /etc/sudoers...

Example: to get password remembered for 5 hours

Defaults        timestamp_timeout=300
  • I think this is actually what i was after, the passwd_timeout is only how long it takes for the password prompt to stay up with no input – Dr Manhattan Jul 18 '15 at 11:40
  • if that's true can you please accept this one instead? the current situation is misleading in that case – im so confused Jul 18 '15 at 14:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.