Force RHEL 7 to set the date 2 years in the past
Here is a question from one of our fellow UNIX Europe group members:
How can he force RHEL 7 to set the date 2 years in the past?
The system tends to revert to our present time after 1 minute and 30 seconds.
We need to force the system to stay 2 years in the past.
We need to mess around with NTP.
Here are the steps:
1. RHEL 7 Boot menu.
2. Boot the system -- System Ready.
3. Boot the system -- Logged In.
4. Switch to root.
su
5. NTP (Network Time Protocol) is up and running.
date
6. NTP (Network Time Protocol) is now stopped.
systemctl stop chronyd
systemctl status chronyd
7. NTP (Network Time Protocol) is disabled and will not start again during boot.
systemctl disable chronyd
8. Set the date back 2 years.
two_years_ago=$(date -d "2 years ago" +"%Y-%m-%d")
date -s "$two_years_ago"
9. We can even set the hardware clock of the computer.
hwclock --systohc
10. Check the date again.
date
That was fun! See you next time. #linux
I am better than AI on Information and Communication Technology (ICT) problem solving - because I can use AI's and filter output from there.
6 个月Umm... it might not work on virtualization. I'd rather look answer for the original question, why clock would need to be back 2 years and find answer for that. Also, Red Hat support won't support you on this kind of solution. And you can't install any recent updates neither. And SSL and other certificates won't work, no MFA/IPA authentication and so on...