ntp时间适配服务器和ssh免密登录

1.配置ntp时间服务器,确保客户端主机能和服务主机同步时间

服务端server向阿里时间服务器进行时间同步

第一步:定位服务端server

#安装软件
[root@server ~]# yum install chrony -y
# 编辑配置文件,定位第3行,修改为阿里的时间服务地址
[root@server ~]# vim /etc/chrony.conf

将下图中的上一行删掉或注释掉写:

server ntp.aliyun.com  iburst

# 重启服务
[root@server ~]# systemctl restart chronyd
# 测试
[root@server ~]# chronyc sources -v

ntp时间适配服务器和ssh免密登录_第1张图片

[root@server ~]# timedatectl status

ntp时间适配服务器和ssh免密登录_第2张图片

# 设置允许客户端时间同步
[root@server ~]# vim /etc/chrony.conf
allow 192.168.176.129/24  # 定位第23行,设置谁可以访问本机进行同步

ntp时间适配服务器和ssh免密登录_第3张图片

更新一下配置文件
[root@server ~]# systemctl restart chronyd

客户端node1向服务端server进行时间同步

第二步:定位客户端node1

# 安装软件
[root@node1 ~]# yum install chrony -y
# 编辑配置文件
[root@node1 ~]# vim /etc/chrony.conf
上一行注释掉写server的ip
# 重启服务
[root@node1 ~]# systemctl restart chronyd
# 测试
[root@node1 ~]# chronyc sources -v

ntp时间适配服务器和ssh免密登录_第4张图片

[root@node1 ~]# timedatectl status

ntp时间适配服务器和ssh免密登录_第5张图片

2.配置ssh免密登陆,能够实现客户端主机通过服务器端的redhat账户进行基于公钥验证方式的远程连接

1.先在服务端创建rehat
[root@server ~]# useradd redhat
[root@server ~]# passwd

ntp时间适配服务器和ssh免密登录_第6张图片

2.定位客户端,制作公私钥对
[root@node1 ~]# ssh-keygen -t rsa

ntp时间适配服务器和ssh免密登录_第7张图片

3.定位客户端,将公钥上传到服务器端
[root@node1 ~]# ssh-copy-id [email protected]

ntp时间适配服务器和ssh免密登录_第8张图片

4.拿客户端测试:
[root@node1 ~]# ssh [email protected]

ntp时间适配服务器和ssh免密登录_第9张图片

成功!!!

你可能感兴趣的:(RHCE,服务器,ssh,运维,linux)