红联Linux门户
Linux帮助

Linux创建信任机制

发布时间:2015-11-08 15:53:08来源:linux网站作者:zuixinyan

在node1上
[root@node1 backup]# cd ~/.ssh
[root@node1 .ssh]# ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
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:
40:93:30:6f:60:06:9b:d0:50:97:3d:47:01:a8:f8:cc root@node1
The key’s randomart image is:
+–[ RSA 2048]—-+
|o+o.B=++o. |
| ..*o=+.. |
| .o. +o |
|. . . . |
| + S |
| E |
| |
| |
| |
+—————–+


这里执行ssh-keygen -t rss 这个命令后会出现一些命令让输入指令 这里直接敲回车就可以了。


会生成两个文件 id_rsa id_rsa.pub
[root@node1 .ssh]# ls
id_rsa id_rsa.pub known_hosts


然后将id_rsa.pub导入到其他节点服务器上相应的目录下

[root@node1 .ssh]# scp id_rsa.pub 192.168.1.102:/root/.ssh
root@192.168.1.103’s password:
id_rsa.pub 100% 392 0.4KB/s 00:00


然后去102服务器相应目录下
[root@node2 .ssh]# cat id_rsa.pub>authorized_keys 注意这个文件名一定不能错


然后在node1节点连接node2
[root@node1 .ssh]# ssh 192.168.1.102
Last login: Fri Oct 9 00:39:19 2015 from 192.168.1.100


连接成功
[root@node3 ~]# exit


Linux主机间建立信任关系:http://www.linuxdiyf.com/linux/15175.html

Linux批量建立信任关系,实现ssh无密码登陆的脚本:http://www.linuxdiyf.com/linux/12866.html

建立Linux ssh信任及常见问题解决办法:http://www.linuxdiyf.com/linux/10151.html

Linux技巧:Linux主机信任关系配置:http://www.linuxdiyf.com/linux/841.html