sudo: timestamp too far in the future

Linux howto's, compile information, information on whatever we learned on working with linux, MACOs and - of course - Products of the big evil....
Post Reply
User avatar
^rooker
Site Admin
Posts: 1483
Joined: Fri Aug 29, 2003 8:39 pm

sudo: timestamp too far in the future

Post by ^rooker »

[PROBLEM]
After changing date/time on my server, I received this errormessage when executing sudo:
sudo: timestamp too far in the future
[SOLUTION]
Remove any references to previous sudo executions from your user.
(Unfortunately you have to have an enabled root account to do this)

Code: Select all

su root
rm -R /var/run/sudo/$LOGNAME/*
-- OR --
Set your date/time to some time AFTER the one sudo is expecting.
run "sudo -k" to clear the timestamp.
Set date/time back to what it should be.

-- OR --
Open another terminal (Alt+Fsomething) and log in as your non-root user.
Reset the timestamps of the sudo files to -now-:

Code: Select all

sudo touch /var/run/sudo/$LOGNAME/*
(For some strange reason, my newly set up Ubuntu server 6.06 suddenly decided to change the timestamp for my current login)


[ADDITIONAL Information]
The problem seems to be caused by wrong timestamps of the files in /var/run/sudo/$LOGNAME (where $LOGNAME is the username you're currently logged in as).

Further solutions, infos, can be found here.
Last edited by ^rooker on Sun Jan 07, 2007 2:24 pm, edited 3 times in total.
User avatar
^rooker
Site Admin
Posts: 1483
Joined: Fri Aug 29, 2003 8:39 pm

sudo: unable to lookup xxx via gethostbyname()

Post by ^rooker »

[PROBLEM]
I've fiddled around with /etc/hosts and removed the FQDN from the 127.0.0.1 line and added a new one with the external IP.

This is what sudo said to my changes:
sudo: unable to lookup xxx via gethostbyname()
(where "xxx" was my previous hostname)

[SOLUTION]
Restore the original situation in /etc/hosts. Ususally you would have the first line like this:

Code: Select all

127.0.0.1 localhost xxx
Afterwards, you can sudo again - and this time make sure that your changes are ok. You might also want to cleanly change your hostname:

Code: Select all

# get a su shell, because sudo won't work when half-way within changing the hostname:
sudo -i

# edit /etc/hosts to look somehow like this:
127.0.0.1	localhost
192.168.1.5	newhostname.mydomain.com	newhostname

# Now let the rest of the system know the right hostname:
hostname dracul
echo "newhostname" > /etc/hostname

# Test your changes:
hostname		# should return "newhostname"
hostname -f		# should return "newhostname.mydomain.com"
Post Reply