As Linux users, we are accustomed to use sudo to acquire super user permissions when we are typing commands on the terminal. This program asks us to enter our user’s password and then, if it is correct and our user is authorized to use sudo, it will execute the command that we have passed as root.
What some may not know is that sudo gives us a period of time to enter the password, if we do not do it in time, the process is automatically cancelled with a time out error.
Most likely you have never seen this error, since normally sudo is used interactively and you have enough time to see that the password prompt and type before it times out. But when sudo is part of a script or is used by another console application, like yay, it may happen that you don’t have the terminal in sight at the moment when the password is requested and by the time you realize it, it would have expired, interrupting the whole process you had running.
To prevent this from happening, we can configure sudo to not have a time limit at the time of typing our password. We will only have to edit /etc/sudoers with our favourite editor, for example:
$ sudo nano /etc/sudoers
Find a line that begins with the word Defaults and add passwd_timeout=0 at the it’s end, for example:
If you can’t find a line that starts with Defaults, you’ll just have to create a new one.
If you find a line that starts with Defaults, you’ll have to add passwd_timeout=0 separating it with a comma and a space from the end of the line, for example, if you find this:
Defaults env_keep += "HOME"
You modify it to be as follows:
Defaults env_keep += "HOME", passwd_timeout=0
Now we just have to save the changes we’ve just made and we are done.Tweet to @eliasrm87