Change Ubuntu Server Timezone

If you are using a Ubuntu VPS or dedicated server, then you may have noticed emails coming from server doesn’t match your local timezone.

Below are 2 methods to quickly fix this issue…

Method#1 – Interactive Mode

Just run following command…

dpkg-reconfigure tzdata

and it will show a list of timezone from where you can select your timezone

Method#2 – Non-Interactive mode

In this method you need to provide value of timezone manually.You can find timezone values here.

sudo echo "Asia/Calcutta" > /etc/timezone
sudo dpkg-reconfigure --frontend noninteractive tzdata

After running above command I got following output:

Current default time zone: 'Asia/Kolkata'
Local time is now: Thu Jul 12 18:56:32 IST 2012.
Universal Time is now: Thu Jul 12 13:26:32 UTC 2012.

Why 2 methods?

Non-interactive way comes handy if you want to change timezone programatically. ;-)

Fix File Permission on Linux/Mac Server

Over the time, file permissions get messy on a linux/mac server. It really annoys (me) to see static files like images have 0755 i.e. executable permission set for them.

You can use following commands to fix permissions:

find . -type d -print0 | xargs -0 chmod 0775
find . -type f -print0 | xargs -0 chmod 0664

I found many scripts and tools to do this job. IMHO, above command does what we really need!

For WordPress

Ideally, on a wordpress site, no files under “wp-content/uploads” directory should be executable. In case of WordPress multisite, it will be “wp-content/blogs.dir” directory.

Its better to fix file-permissions periodically on your WordPress setup.