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?