输入下方命令后一直按回车结束
[root@k8s-master01 ~]# ssh-keygen -t dsa
Generating public/private dsa key pair.
Enter file in which to save the key (/root/.ssh/id_dsa):
Created directory '/root/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_dsa.
Your public key has been saved in /root/.ssh/id_dsa.pub.
The key fingerprint is:
SHA256:pEj0APNNb9czHYRvmIzb090PodH480KvJt/XKStrBuE root@k8s-master01
The key's randomart image is:
+---[DSA 1024]----+
| o.o . oo |
| + = . ... . |
| o o + .o+*. |
| . . + o. *o= |
| . . S .o * o.|
| E. + * o|
| . o =+|
| +..oo*|
| o.o==oo|
+----[SHA256]-----+
3.分发秘钥
[root@k8s-master01 ~]# ssh-copy-id -i /root/.ssh/id_dsa.pub root@10.0.0.2
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_dsa.pub"
The authenticity of host '10.0.0.2 (10.0.0.2)' can't be established.
ECDSA key fingerprint is SHA256:IuIDvqYaTU/dA4wC21iLNMFsr0p1G5S70rnEi5s7xKc.
ECDSA key fingerprint is MD5:6f:54:e7:50:4c:74:39:09:23:24:7a:79:12:fd:be:78.
Are you sure you want to continue connecting (yes/no)? yes
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
root@10.0.0.2's password:
Number of key(s) added: 1
Now try logging into the machine, with: "ssh 'root@10.0.0.2'"
and check to make sure that only the key(s) you wanted were added.
4.测试
[root@k8s-master01 ~]# ssh 10.0.0.2
Last login: Tue Sep 28 09:04:00 2021 from 10.0.0.200
[root@learn2 ~]#
分发SS安装AnsibleAnsible的使用1.分发SSH1.安装sshpassyum install sshpass -y2.生成秘钥输入下方命令后一直按回车结束[root@k8s-master01 ~]# ssh-keygen -t dsaGenerating public/private dsa key pair.Enter file in which to save the key (/root/.ssh/id_dsa): Created directory '/ro.