linux服务器配置域名ssh 互信
主机信息
192.168.10.10 node1.zzx.com
192.168.10.11 node2.zzx.com
分别配置主机域名
hostname node1.zzx.com
hostname node2.zzx.com
分别修改配置 vim /etc/sysconfig/network
修改 HOSTNAME=node1.zzx.com
HOSTNAEM=node2.zzx.com
vim /etc/hosts
添加 192.168.10.10 node1.zzx.com node1
192.168.10.11 node2.zzx.com node2
切换su
创建配置nod1node2主机的ssh 互信
1.生成sshd 的秘钥
[root@node1 ~]# ssh-keygen -t rsa -f ~/.ssh/id_rsa -P ‘‘
Generating public/private rsa key pair.
Created directory ‘/root/.ssh‘.
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
b7:76:48:4f:ac:f8:e7:5e:d8:89:51:e4:ff:b7:c8:7c [email protected]
2.拷贝node1主机的秘钥到node2
[root@node1 ~]# ssh-copy-id -i .ssh/id_rsa.pub [email protected]
15
The authenticity of host ‘192.168.10.11 (192.168.10.11)‘ can‘t be established.
RSA key fingerprint is 2e:ec:e9:b9:34:2c:c4:46:84:bf:85:ad:e9:22:17:3c.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added ‘192.168.10.11‘ (RSA) to the list of known hosts.
[email protected]‘s password:
Now try logging into the machine, with "ssh ‘[email protected]‘", and check in:
.ssh/authorized_keys
to make sure we haven‘t added extra keys that you weren‘t expecting.
5.测试访问
ssh node1 (链接无需输入密码)
ssh node2 (链接无需输入密码)
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。