ssh免秘钥快速配对。

1,ssh-keygen -t rsa -P '' 生成秘钥对一路回车。
2,cd /root/.ssh/
[[email protected] .ssh]# ls
authorized_keys id_rsa id_rsa.pub known_hosts
3.ssh-copy-id -i id_rsa.pub root@192.168.1.3 //将公钥用ssh命令传送过去,提示选择yes,输入1.3的密码
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.

出现这样的画面就说明成功了。
[[email protected] .ssh]#ssh 192.168.1.3 连接实验。
Last login: Thu Nov 22 13:53:54 2018 from 223.71.70.3

Welcome to Alibaba Cloud Elastic Compute Service !
ifconfig 查看下。
eth0 Link encap:Ethernet HWaddr 00:16:3E:0C:D3:20
inet addr:192.168.1.3 Bcast:192.168.1.255 Mask:255.255.225.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:160505418 errors:0 dropped:0 overruns:0 frame:0
TX packets:170007258 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:18405747186 (17.1 GiB) TX bytes:305412001306 (284.4 GiB)

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:9891200 errors:0 dropped:0 overruns:0 frame:0
TX packets:9891200 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:3422409503 (3.1 GiB) TX bytes:3422409503 (3.1 GiB)
反之亦然,在192.168.1.2操作上面的步骤,如果新添加服务器步骤一样。

猜你喜欢

转载自www.cnblogs.com/sunju/p/10000901.html
今日推荐