TechTorch

Location:HOME > Technology > content

Technology

How to Set Time Zone in PuTTY and Linux Servers

March 13, 2025Technology4955
How to Set Time Zone in PuTTY and Linux Servers PuTTY is a client that

How to Set Time Zone in PuTTY and Linux Servers

PuTTY is a client that facilitates communication, and it does not manage the time zone on its own. Instead, it uses the time zone information from your local machine. However, once you log into a server, you might need to set the time zone for that server. This article will guide you on how to set the time zone in PuTTY and in Linux servers, specifically focusing on how to do it in a CentOS environment.

Setting Time Zone in PuTTY

Since PuTTY itself does not need to know the time zone, the process of setting the time zone usually involves configuring the server where you are running the terminal commands. However, if you are using PuTTY to connect to a server and the server requires the time zone to be set, follow these steps to adjust the time zone settings on the server.

Setting Time Zone on Linux Servers

The process of setting the time zone can vary depending on the Linux distribution you are using. In this example, we will guide you through the process for a CentOS server. Here are the steps:

Step 1: Change the Time Zone

One way to set the time zone is to create a symbolic link that points to the desired time zone file. This file is located in the /usr/share/zoneinfo/ directory. For example, if you want to set the time zone to New York, you can follow these steps:

Open a terminal session on the server. Navigate to the /etc/ directory using the command cd /etc. Create a symbolic link to the desired time zone file by running the following command:
ln -s /usr/share/zoneinfo/America/New_York localtime

Step 2: Verify the Time Zone Change

To confirm that the time zone has been successfully changed, you can check the contents of the /etc/localtime file. The resulting output should resemble the following:

lrwxrwxrwx 1 root root 38 May 3 2021 localtime - /usr/share/zoneinfo/America/New_York

Step 3: Using timedatectl to Set Time Zone

If your server is running newer versions of the systemd system, such as CentOS 7 and later, you can use the timedatectl command to set the time zone. To do this, run the following command:

timedatectl set-timezone America/New_York

After setting the time zone, you can use the timedatectl command to verify the change:

timedatectl

This command will display detailed information about the current system time settings, including the set time zone.

Step 4: Rebooting the Server

After changing the time zone, it is recommended to reboot the server to ensure that all services and processes are updated with the new time zone information. Rebooting will also help to ensure that the time is displayed correctly across all services and user sessions.

Keeping the Time Accurate

To keep the time on the server accurate, you should install and enable the Network Time Protocol (NTP) service. NTP can synchronize the server's clock with accurate time sources to prevent drift from losing or gaining time over a period.

Here are the general steps to enable NTP:

Step 1: Install and Enable NTP

On CentOS, you can install NTP using the following command:

yum install ntp

After installation, enable the NTP service to start on boot:

systemctl enable ntpd

Start the NTP service:

systemctl start ntpd

Step 2: Configure NTP to Update Using an NTP Pool

The default NTP configuration file is usually located at You can configure it to use an NTP pool server or specific time servers. Here’s an example configuration:

server server server server 

After making changes to the configuration file, restart the NTP service to apply the new settings.

systemctl restart ntpd

Step 3: Update Firewall Rules

Ensure your firewall allows NTP traffic. The typical NTP port is TCP and UDP port 123. You can add the necessary rules to your firewall using commands like firewalld or iptables as appropriate for your server:

firewall-cmd --add-servicentp --permanentfirewall-cmd --reload

These steps will configure your server to keep the time accurate and synchronized with standard time sources.

Conclusion

Setting the time zone in PuTTY and Linux servers involves configuring your server rather than the client itself. By following the steps outlined in this guide, you can set the correct time zone and ensure accurate timekeeping on your server, even after making changes. Additionally, configuring NTP will help to keep the time accurate and synchronized across all services.