Sudo is Not Prompting For a Password When Re-executed Second Time

by Vivek Gite on February 3, 2008 · 1 comment

Q. I use sudo to provide permissions and command execution rights to other users under UNIX and Linux operating systems. However, I noticed something strange about sudo. When executing sudo, it will prompt for the user's password the first time, but sudo no longer requires a password anymore when re-executing it. Why? Is this is a security risk?

A. sudo records the timestamp by creating a file, when it is executed the first time, sudo won't need a password if the timestamp has not timed out. The time out value is 600 seconds (5 minutes) by default.

timestamp_timeout

Number of minutes that can elapse before sudo will ask for a passwd again. The default is 5. Set this to 0 to always prompt for a password. If set to a value less than 0 the user’s timestamp will never expire. Open /etc/sudoers
# vi timestamp_timeout
And set timestamp_timeout as per your setup:
timestamp_timeout 0

sudo -k option

This can be used to allow users to create or delete their own timestamps via sudo -v and sudo -k respectively. Run sudo -k to invalidate the timestamp after executing sudo.
$ sudo -k

passwd_timeout

Number of minutes before the sudo password prompt times out. The default is 5, set this to 0 for no password timeout.
passwd_timeout 2

Featured Articles:

Share this with other sys admins!
Facebook it - Tweet it - Print it -

{ 1 comment… read it below or add one }

1 Nik May 24, 2011

I really didn’t understand anything. HOW DO YOU CHANGE the timestamp_timeout ?
Add that in sudoeds ? Nothing happened i got a parse error.

Sudo -k does nothing

HOW ?

Reply

Leave a Comment

You can use these HTML tags and attributes for your code and commands: <strong> <em> <ol> <li> <u> <ul> <blockquote> <pre> <a href="" title="">
What is 3 + 15 ?
Please leave these two fields as-is:
Solve the simple math so we know that you are a human and not a bot.




Previous post:

Next post: