linux远程设置无外网服务器的系统时间
使用ssh设置服务器时间
ssh root@${hostname} send "date -s '2022-05-27 00:00:00"
使用shell脚本设置服务器:
/usr/bin/expect<<-EOF
spawn ssh root@${hostname}
expect {
"(yes/no)"
{send "yes\r";exp_continue}
"*password"
{send "$password\r"}
}
expect "*]#"
send "date -s '$times'\r"
expect eof
EOF
done

浙公网安备 33010602011771号