Linux 创建信任机制
2015-10-10 20:44
615 查看
在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
[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 socket 初步
- linux lsof详解
- linux 文件权限
- Linux 执行数学运算
- 10 篇对初学者和专家都有用的 Linux 命令教程
- Linux 与 Windows 对UNICODE 的处理方式
- Ubuntu12.04下QQ完美走起啊!走起啊!有木有啊!
- 解決Linux下Android开发真机调试设备不被识别问题
- 运维入门
- 运维提升
- Linux 自检和 SystemTap
- Ubuntu Linux使用体验
- c语言实现hashmap(转载)
- Linux 信号signal处理机制
- linux下mysql添加用户
- Scientific Linux 5.5 图形安装教程
- 基于 Linux 集群环境上 GPFS 的问题诊断
- 谁是桌面王者?Win PK Linux三大镇山之宝
- vivi下重新调整分区