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?
Asked
Active
Viewed 7,664 times
1 Answers
17
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.
So, to change that to, for example, 5, 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 user with a very severe case of OCD, they won't attempt to enter a password more than 100 million times.

terdon
- 100,812
passwd_tries
) – αғsнιη Oct 11 '14 at 16:18passwd_tries=
and now I can not open againsudo visudo
even I can not run any commands with sudo or gksu and gksudo ;( – αғsнιη Oct 11 '14 at 16:21pkexec visudo
and saved it again thanks it fixed. – αғsнιη Oct 11 '14 at 16:36/etc/sudoers
directly. That's why I told you to usevisudo
. That would have protected you from this problem. – terdon Oct 11 '14 at 16:49visudo
should prevent the creation of a bad sudoers file, if you do create one that is bad or (more likely, withvisudo
) valid but nonfunctional, the method detailed here withpkexec
is usually sufficient to solve it, without even rebooting. – Eliah Kagan Oct 24 '14 at 07:481215752191
. Don't set it to2^31-1
as this can cause trouble depending how the comparison withpasswd_tries
is implemented. At least go down to2^31-2
. – Joachim Wagner Nov 24 '20 at 12:10