1.配置ntp时间服务器,确保客户端主机能和服务主机同步时间。
安装:[root@server ~]# yum install chrony -y
服务端编辑配置文件:[root@server ~]# vim /etc/chrony.conf
要访问服务器,做白名单:
重启服务 :[root@server ~]# systemctl restart chronyd
时间同步:[root@server ~]# chronyc sources -v
查看时间是否同步:[root@server ~]# timedatectl status
客户端编辑配置文件:[root@server ~]# vim /etc/chrony.conf
重启服务 :[root@server ~]# systemctl restart chronyd
时间同步:[root@server ~]# chronyc sources -v
查看时间是否同步:[root@server ~]# timedatectl status
2.配置ssh免密登陆,能够实现客户端主机通过服务器端的redhat账户进行基于公钥验证方式的远程连接。
服务端添加新账户[root@server ~]# useradd redhat
[root@server ~]# passwd redhat
ssh-keygen是用于生成、管理、转换密钥的工具
格式:[root@server ~]# ssh-keygen -t rsa
预处理:2台机子都恢复快照
定位客户端,制作公私钥对
[root@node1 ~]# ssh-keygen -t rsa # 一路回车
定位客户端,将公钥上传到服务器端
[root@node1 ~]# ssh-copy-id root@192.168.208.133 # 输入服务端的账户及IP地址
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes # 输入yes
root@192.168.208.133's password: # 输入服务端redhat账户的的密码
客户端测试:[root@node1 ~]# ssh redhat@192.168.48.130