MasterIP:192.168.2.66
Slave1IP:192.168.2.10
Slave2 IP:192.168.2.18
[root@master ~]# vim /etc/ssh/sshd_config
RSAAuthentication yes PubkeyAuthentication yes AuthorizedKeysFile .ssh/authorized_keys
[root@master ~]# systemctl restart sshd.service
[root@master ~]# ll -a total 60 dr-xr-x---. 7 root root 4096 Mar 19 17:17 . dr-xr-xr-x. 20 root root 4096 Mar 19 17:12 .. -rw-------. 1 root root 1138 Sep 12 2017 anaconda-ks.cfg -rw-------. 1 root root 52 Mar 19 17:11 .bash_history -rw-r--r--. 1 root root 18 Dec 29 2013 .bash_logout -rw-r--r-- 1 root root 201 Jan 16 18:54 .bash_profile -rw-r--r--. 1 root root 176 Dec 29 2013 .bashrc drwxr-xr-x. 3 root root 4096 Sep 12 2017 .cache drwxr-xr-x. 3 root root 4096 Sep 12 2017 .config -rw-r--r--. 1 root root 100 Dec 29 2013 .cshrc drwxr-xr-x 2 root root 4096 Nov 14 17:14 .oracle_jre_usage drwxr-----. 3 root root 4096 Sep 13 2017 .pki drwx------. 2 root root 4096 Mar 19 15:50 .ssh -rw-r--r--. 1 root root 129 Dec 29 2013 .tcshrc -rw------- 1 root root 850 Mar 19 17:17 .viminfo
[root@master ~]# cd .ssh/ [root@master .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: SHA256:UXhkXi1bx/a3jrSoHYhu6C+vD2cWnd67rBjpQEiSk3w root@master The key's randomart image is: +---[RSA 2048]----+ | o+ .. . | |. o .+... o +| | * E ... + o.| | = . ... . o| | . . .So o| | . = o . . | | o.B o oo + | | oO.o o.oo . | | .oBB oo=. | +----[SHA256]-----+
[root@master .ssh]# ll total 8 -rw------- 1 root root 0 Mar 19 15:50 authorized_keys -rw------- 1 root root 1675 Mar 19 17:26 id_rsa -rw-r--r-- 1 root root 393 Mar 19 17:26 id_rsa.pub
[root@master .ssh]# cat id_rsa.pub >> authorized_keys
[root@master ~]# cd .ssh/ [root@master .ssh]# scp id_rsa.pub root@192.168.2.10:~/.ssh/authorized_keys The authenticity of host '192.168.2.10 (192.168.2.10)' can't be established. ECDSA key fingerprint is SHA256:ZTtQLCTg21cYLQ5iJa5LkC51xN6lKGxVyLRAxjXPUOw. ECDSA key fingerprint is MD5:6d:5b:e9:d9:bd:12:64:06:c5:cc:a2:07:a6:99:96:3d. Are you sure you want to continue connecting (yes/no) yes Warning: Permanently added '192.168.2.10' (ECDSA) to the list of known hosts. root@192.168.2.10's password: id_rsa.pub 100% 393 1.2MB/s 00:00
[root@master .ssh]# ssh 192.168.2.10 Last login: Mon Mar 19 21:07:28 2018 from 59.42.207.235 [root@slave1 ~]#
[root@master .ssh]# ssh 192.168.2.18 Last login: Mon Mar 19 21:07:33 2018 from 113.109.21.73 [root@slave2 ~]#
[root@master ~]# chmod 700 .ssh [root@master ~]# chmod 600 .ssh/authorized_keys
[root@slave1 .ssh]# scp id_rsa.pub root@192.168.2.66:~/.ssh/authorized_keys_slave1 root@192.168.2.66's password: id_rsa.pub 100% 393 0.4KB/s 00:00
[root@slave2 .ssh]# scp id_rsa.pub root@192.168.2.66:~/.ssh/authorized_keys_slave2 The authenticity of host '192.168.2.66 (192.168.2.66)' can't be established. ECDSA key fingerprint is b8:0f:8c:d2:9f:10:65:22:73:ea:ea:02:75:89:5d:98. Are you sure you want to continue connecting (yes/no) yes Warning: Permanently added '192.168.2.66' (ECDSA) to the list of known hosts. root@192.168.2.66's password: id_rsa.pub 100% 393 0.4KB/s 00:00
[root@master .ssh]# ll total 24 -rw------- 1 root root 393 Mar 19 17:29 authorized_keys -rw-r--r-- 1 root root 393 Mar 19 21:30 authorized_keys_slave1 -rw-r--r-- 1 root root 393 Mar 19 21:32 authorized_keys_slave2 -rw------- 1 root root 1675 Mar 19 17:26 id_rsa -rw-r--r-- 1 root root 393 Mar 19 17:26 id_rsa.pub -rw-r--r-- 1 root root 348 Mar 19 21:21 known_hosts
[root@master .ssh]# cat authorized_keys_slave1 >> authorized_keys [root@master .ssh]# cat authorized_keys_slave2 >> authorized_keys
[root@slave1 .ssh]# ssh 192.168.2.66 Last failed login: Mon Mar 19 21:32:10 CST 2018 from 192.168.2.10 on ssh:notty There were 2 failed login attempts since the last successful login. Last login: Mon Mar 19 21:28:38 2018 from 113.109.21.73 [root@master ~]#
[root@slave2 .ssh]# ssh 192.168.2.66 Last login: Mon Mar 19 21:36:32 2018 from 192.168.2.10 [root@master ~]#
如对本文有疑问, 点击进行留言回复!!
SSD原理及Pytorch代码解读——网络架构(二):特征提取网络及总体计算过程
集合类 ArrayList 和 LinkedList 直接用 Innodb(MySQL 5.0
网友评论