Ubuntu and many Linux distributions are able to keep time synchronized on a computer by using the Internet and a built in software service called the Network Time Protocol Daemon (NTPD). This service is frequently run on Ubuntu servers. However, when you install the desktop version of Ubuntu 11.10, the NTP daemon is turned off by default. To make up for the lack of NTPD, the desktop version of Oneiric Ocelot runs a program called ntpdate to set the internal clock each time you boot or log into the computer. If you leave your computer on for any length of time, the clock will tend to drift. If you have an older computer, where the CMOS battery is weak, then the drift may be quite substantial, and you will need to manually set the date.
Manually Synchronize your Ubuntu computer to the official NIST time
If your desktop Ubuntu PC is connected to the Internet, then it is easy to manually set the time and date by running ntpdate at the command line. To open the command line dialog press both the alt and F2 key at the same time. A dialog will open and you enter ntpdate followed by the time server you wish to sync time with. The time server can be one that is on your local network, or one of the many publicly available time servers. There even some time servers that are maintained by the Ubuntu community. Here is an example on how to manually synchronize your Ubuntu desktop PC using an Ubuntu time server.
This works if the account you are working from has administrative privileges:
1. Press alt-F2
2. At the command prompt enter: gksudo ntpdate ntp.ubuntu.com
3. You will be prompted for a password.
Enter the password your administrative account and the computer will adjust its time in the background with the ntp server provided by Ubuntu. The time server selected in the above example uses a server maintained by the Ubuntu community. Other public servers are available by checking out http://www.pool.ntp.org
Run ntpdate from cron once a day
There is another method that will allow you set your ubuntu desktop computer up just like an Ubuntu server using the NTP Daemon by using the /etc/daily.cron file. You can run ntpdate from a service that is available on your PC called 'cron.'
Cron allows you to run various programs on your computer at set time intervals. The easiest way to access the cron programs is to make modification to the file system on your computer from an administrative account.
If you are a user on your PC that has administrative rights then all you have to do is add this file to /etc/cron.daily to run the ntpdate program once per day automatically. You can give this file any name and here is an example of how to set up automatic time syncronization on your ubuntu desktop:
1. Enter gksudo gedit /etc/daily.cron/timeUpdate
2. You will be prompted to enter a password. After entering your password a file editor will appear.
3. Enter the following in your editor ntpdate time.ubuntu.com Select 'File → Save' and then close the gedit program.
Once you have exited the program, you will need to change the permissions of /etc/cron.daily/timeUpdate so that it will execute once per day. This is accomplished by hitting alt-F2 and typing gksudo chmod u+x /etc/cron.daily/timeUpdate.
Now your Ubuntu PC will check once per day to keep its time in sync with the NIST standard time. The advantage to using this method is that the program is not a continually running process or daemon as a server would use.
Manually Synchronize your Ubuntu computer to the official NIST time
If your desktop Ubuntu PC is connected to the Internet, then it is easy to manually set the time and date by running ntpdate at the command line. To open the command line dialog press both the alt and F2 key at the same time. A dialog will open and you enter ntpdate followed by the time server you wish to sync time with. The time server can be one that is on your local network, or one of the many publicly available time servers. There even some time servers that are maintained by the Ubuntu community. Here is an example on how to manually synchronize your Ubuntu desktop PC using an Ubuntu time server.
This works if the account you are working from has administrative privileges:
1. Press alt-F2
2. At the command prompt enter: gksudo ntpdate ntp.ubuntu.com
3. You will be prompted for a password.
Enter the password your administrative account and the computer will adjust its time in the background with the ntp server provided by Ubuntu. The time server selected in the above example uses a server maintained by the Ubuntu community. Other public servers are available by checking out http://www.pool.ntp.org
Run ntpdate from cron once a day
There is another method that will allow you set your ubuntu desktop computer up just like an Ubuntu server using the NTP Daemon by using the /etc/daily.cron file. You can run ntpdate from a service that is available on your PC called 'cron.'
Cron allows you to run various programs on your computer at set time intervals. The easiest way to access the cron programs is to make modification to the file system on your computer from an administrative account.
If you are a user on your PC that has administrative rights then all you have to do is add this file to /etc/cron.daily to run the ntpdate program once per day automatically. You can give this file any name and here is an example of how to set up automatic time syncronization on your ubuntu desktop:
1. Enter gksudo gedit /etc/daily.cron/timeUpdate
2. You will be prompted to enter a password. After entering your password a file editor will appear.
3. Enter the following in your editor ntpdate time.ubuntu.com Select 'File → Save' and then close the gedit program.
Once you have exited the program, you will need to change the permissions of /etc/cron.daily/timeUpdate so that it will execute once per day. This is accomplished by hitting alt-F2 and typing gksudo chmod u+x /etc/cron.daily/timeUpdate.
Now your Ubuntu PC will check once per day to keep its time in sync with the NIST standard time. The advantage to using this method is that the program is not a continually running process or daemon as a server would use.
Published by J.A. McLynne
An information technology professional by trade, I enjoy cooking, reading novels, and refurbishing old computers. I also write on the side to change pace. View profile
- The Best and Worst About Ubuntu KarmicI've been living with with Ubuntu 9.10 "Karmic Koala" for more than few days, and I'm very happy over all...but there are still a few things that disappointed me about this release.
- 3 Apps that Make Ubuntu More like a MacWant to make your Ubuntu desktop more like a Mac OS X Leopard one? Here are some things that might help!
- How to Download and Install Ubuntu LinuxHere is how to download and install Ubuntu Linux for desktop, server, netbook, and alongside Windows.
- Guest Sessions in UbuntuSeveral ways to have a guest session option available under Ubuntu. You choose which way works best for you.
- Forgot Your Administrative Password? How to Access Your PC AnywayForgetting a password is one of the most annoying yet preventable problems you will face with your computer - particularly if it is your administrative password. This tututorial article discusses three different ways...
- Preview of Ubuntu 11.10 "Oneiric Ocelot"
- Review of Ubuntu Operating System
- Ubuntu Wins Operating System Wars
- Automate Ubuntu Backups with Cron and TAR
- Automating Ubuntu Backups with TAR and Cron
- Mozilla's Prism: Get Web Apps on Your Ubuntu Desktop
- Freshen Your Ubuntu Desktop with the Ubuntu Studio Theme



