How does sudo remember you already entered root's password?
-
When using sudo on Linux, it asks for root password, but only the first time you run it. If you run another sudo command, it remember you already entered the password previously and doesn't ask for it: thomas@ubuntu:~$ sudo id [sudo] password for thomas: ****** uid=0(root) gid=0(root) groups=0(root) thomas@ubuntu:~$ sudo id uid=0(root) gid=0(root) groups=0(root) How does sudo do it? Where is this information stored? My idea is that it remembers the terminal id (like pts/1), but where is this stored? The first sudo process is ended when it's done with the command, right? I know sudo is a setuid program, so it has root's privileges all the time, but I still can't think of a good place to store an information that a user has already entered a password. Is there some daemon process involved?
-
Answer:
Where is this information stored? It's probably under /var/db/sudo or /var/run/sudo and you'll probably find directories of usernames with files under them ordered by tty number. The actual privileges granted, including how long the sessions lasts before you have to enter your password again depends on how sudoers is setup. There's settings to grant/restrict a lot of different things, but those aren't stored in these files which only store timestamps. How long a session lasts, or when sudo needs to prompt for your password again, is determined by a delta of current time and the session timestamp in this directory, and how long sudo is setup to allow a session to last.
kuba at Unix and Linux Visit the source
Other answers
Try man sudo and have a look at the FILES section: /var/lib/sudo Directory containing time stamps And at the SECURITY NOTES sudo will check the ownership of its time stamp directory (/var/lib/sudo by default) [...] (man pages from Debian 6.0.4)
Andreas Florath
Related Q & A:
- How do I add an item to Finder's sidebar?Best solution by Stack Overflow
- How do I open my already sent drafts?Best solution by Yahoo! Answers
- How can I delete my yahoo email account and password forever?Best solution by Yahoo! Answers
- How to keep your grades up to A's and B's?Best solution by martynemko.com
- How to get my email if I lost my password?Best solution by answers.microsoft.com
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.