on the server side
vim /etc/chrony.conf
29 local stratum 10 ##Enable the time sharing function and set the sharing level
##After this parameter is enabled, the machine does not synchronize other people's time to this machine
22 allow 172.25.254.0/24 ##The time to allow those clients to access the local share
systemctl restart chronyd
Note: The firewall on the server side should be closed at this time
On the client side:
vim /etc/chrony.conf
server 172.25.254.120 iburst ##Sync server host time
systemctl restart chronyd ##Restart the service
chronyc sources -v ##Check whether the time is synchronized
^* means successful synchronization ^? means not synchronized
###View time, set time command
timedatectl ##View time
timedatectl list-timezones ##View time zone
timedatectl set-timezone Asia/Shanghai ##Set time zone
timedatectl
date
vim /etc/adjtime
timedatectl set-local-rtc 1 ##Set the local time
vim /etc/adjtime
timedatectl set-local-rtc 0 ##Set to utc time
vim /etc/adjtime
timedatectl
timedatectl set-time "2018-11-11 11:11:11" ##Change the current local time
date
at ##Delayed task operation command
at time
at now+5min ##Execute the task after 5 minutes
at 16:38 ## Execute the task at 16:38
>touch /mnt/file{1..10}
>ctrl+d ##End operation
at -l ##View delayed task job number
at -c job number ##View delayed tasks
at -r job number ##Undo delayed tasks
##Steps##
vim /etc/at.deny ##Set the at user to use the blacklist
useradd westos
useradd linux
su - linux
su - westos
vim /etc/at.allow ##Set the at user to use a whitelist (all other users are blacklisted by default)
su - linux
su - westos
at now+1min
vim /etc/at. allow
su - linux