Search Our Database
How to manually set server date and time in Linux server
Introduction
This article is intended for system administrators or technical users who need to manually set the date and time on a Linux server. It provides a step-by-step guide on how to use the date command to change the system’s clock. This is useful when automatic time synchronization is disabled, or the server’s time needs to be corrected. The guide applies to Linux servers, typically accessed via SSH, and is crucial when time-sensitive applications rely on accurate system time.
Prerequisites
- You have SSH access to the server.
- You have root privileges on the server.
- You know the correct date and time that needs to be set.
Step-by-Step Guide
Step 1: SSH into your server
- Open your terminal or use a tool like PuTTY to establish an SSH connection.
- Connect to your server using the following command (replace your_server_ip with your server’s IP address):
ssh root@your_server_ip
Step 2: Set the date and time
- Run the following command to set the server’s date and time:
date --set="Mmm DD HH:MM:SS YYYY"
- Replace Mmm with the abbreviated month (e.g., Oct for October), DD with the day, HH:MM:SS with the hour, minute, and second, and YYYY with the year.
- Example:
date --set="Oct 20 15:52:29 2024"
Step 3: Verify the date and time
- To confirm that the date and time have been set correctly, run the following command:
date
- The output should display the current system date and time.
Conclusion
Manually setting the date and time on a Linux server is straightforward using the date command. Always ensure the correct date and time are applied, as inaccuracies may affect system processes and logs. For automated solutions, consider enabling Network Time Protocol (NTP) synchronization.
For additional assistance or if you encounter any issues, please contact our support team at support@ipserverone.com.
Article posted by Louis on 20 March 2020.