Amazon Web Services Linux Rackspace

Is your Linux Timezone Reverting to UTC After Rebooting?

Being based in Perth (GMT +8), I have always thought it made sense to have our servers running in the Australia/Perth timezone (rather than UTC).

This makes sense for many reasons, mostly that when we set up a cron job, we can use local time (rather than UTC), which makes life very easy.

Recently our Rackspace Cloud servers and Amazon EC2 instances (both running CentOS) were rebooted after updating the glibc package, which caused each server’s timezone to revert back to UTC.

To set the timezone, I had always created a /etc/localtime symbolic link pointing to /usr/share/zoneinfo/Australia/Perth, however it turns out that there is one other thing that has to be done in order to make the timezone setting be persistent across updates and reboots.

Luckily, the solution was hidden away in the AWS user guide.

In addition to the symlink, it is also necessary to edit the /etc/sysconfig/clock file, and change it to your local timezone ( in my case ZONE="Australia/Perth" ).

After making both of these changes, be sure to reboot your server, and then use the date command to check that your server is still in your local timezone (rather than UTC).


Copy your ssh public key to a server from a machine that doesn’t have ssh-copy-id

A very simple (one command) way of copying your SSH public key to a remote server.

cat ~/.ssh/ | ssh [email protected] "cat >> ~/.ssh/authorized_keys"

or im my case:

cat ~/.ssh/ | ssh [email protected] "cat >> ~/.ssh/authorized_keys"

(replace [email protected] with your SSH username and server hostname)

I’ve previously tried to do this using a manual copy-and-paste method, but it is error prone because the key quite often gets split over multiple lines.

Using this method helps ensure that your SSH key gets copied over completely.

Thanks to for this idea.