先查看防火墙:
[root@localhost ~]# systemctl status firewalld
[root@localhost ~]# systemctl disable --now firewalld #关闭开机自启动防火墙
再查看selinux:
[root@localhost ~]# getenforce #查看selinux当前状态
[root@localhost ~]# setenforce 0 #临时设置selinux为permissive
[root@localhost ~]# vim /etc/selinux/config #进入配置文件修改selinux为permissive,下次登陆就不需要修改
SELINUX=permissive
先在客户端创建redhat用户,然后生成公私钥,将生成的公私钥放入服务端的/root/.ssh/,最后远程登陆
[redhat@dongxinhai ~]$ ssh-keygen -t rsa #生成公私钥
[redhat@dongxinhai ~]$ ssh-copy-id root@192.168.17.128 #将生成的公私钥放入服务端的/root/.ssh/,并输入密码
Number of key(s) added: 1 #显示成功放入
Now try logging into the machine, with: "ssh 'root@192.168.17.128'"and check to make sure that only the key(s) you wanted were added.
[redhat@dongxinhai ~]$ ssh root@192.168.17.128 #进行免密登录