sudo: timestamp too far in the future - fixing sudo problem

chris (2007-09-18 12:34:41)
0 replies
If you have fiddled with the date or time settings on your system, you might find sudo starts to complain with an error like this:
chris@chris-laptop:~$ sudo bash
sudo: timestamp too far in the future: Sep 18 19:52:12 2007

This is because sudo comes with some in-built magic, storing timestamps of users' sudo access in a file. If a user attempts to sudo when the system time is ahead of the last stored sudo timestamp for that user, then sudo complains and prevents access. This is most probably for security reasons, but it may also be to prevent weirdness in other parts of the system, such as log chronology and monitoring.

To fix this problem is easy - just issue sudo with the -k option like this:
chris@chris-laptop:~$ sudo -k
you can then use sudo as normal:
chris@chris-laptop:~$ sudo bash
sudo -k runs silently. All it does is clean up the user's last timestamp. To quite from the man page: "The -k (kill) option to sudo invalidates the user's timestamp by setting the time on it to the epoch. The next time sudo is run a password will be required. This option does not require a password and was added to allow a user to revoke sudo permissions from a .logout file.

Hope that's useful