11

By default, sudo prompts me to input my user password a maximum of three times if I input wrong password. How can I change it to unlimited times(?)? How can I make it so that it asks me for my password until I enter the right one?

terdon
  • 104,119
αғsнιη
  • 36,350

1 Answers1

18

This is documented in man sudoers. The setting you are looking for is:

 passwd_tries      The number of tries a user gets to enter his/her pass‐
                   word before sudo logs the failure and exits.  The
                   default is 3.

To change that to 5, for example, run sudo visudo and add these lines:

## Allow a user to attempt to enter a password 5 times
Defaults        passwd_tries=5

As far as I know, there is no way to set it to unlimited times but you can simply use a huge number:

Defaults        passwd_tries=99999999

That is unlimited for all intents and purposes. Unless you have a very dedicated user, they won't attempt to enter a password more than 100 million times.

terdon
  • 104,119