Comment 14 for bug 43233

Revision history for this message
kko (kko) wrote :

I am using Kubuntu Dapper ("sudo -V": Sudo version 1.6.8p12), and my original recipe still "works" for me.

I might add that "sudo -v" (small v, not capital V) doesn't work either, even though it, like the -k and -K switches, could possibly be used to rectify the situation. ("man sudo": "By giving sudo the -v flag a user can update the time stamp without running a command.")

So, to recapitulate:
- You can use sudo from a different shell or from a different tty, even when you have a "bad" timestamp file for another shell or tty. Utilising this fact you can
- 1) set the time to the future (3 hours is more than enough),
- 2) from another shell, issue "sudo rm /var/run/sudo/yourusername/*" to remove all the timestamps - this is important to reliably simulate the effect,
- 3) following my original recipe, log in on the first virtual console (tty1),
- 4) and change the time to current with "sudo date -s hh:mm:ss".

- At this point, when I try "sudo -k", "sudo -K", "sudo -v", "sudo ls -l", or indeed anything "sudo", _and_ do it from the same virtual console (tty1), all I get is "sudo: timestamp too far in the future:" followed by the date and time of the timestamp file (/var/run/sudo/myusername/tty1, in this case).
- I repeat that I _do not_ get "sudo" asking for my password for any of the "sudo" commands named above, I _only_ receive the warning.

To illustrate the point - if I now login on the second virtual console (tty2), I can use sudo there (and it will ask for my password, as required), and will obtain the following results:
$ sudo ls -l /var/run/sudo/myusername/
Password:
total 0
-rw------- 1 root root 0 2006-12-13 22:01 tty1
-rw------- 1 root root 0 2006-12-13 19:09 tty2

In between those timestamps I have switched the time from 22-something to 19-something.

(To be completely truthful, I had a couple other timestamp files there too, from Konsole sessions I tested, but for the sake of clarity I removed those from the extract.)