生成秘钥
~]# ssh-keygen -t rsa -P ''
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:HOkv0BllhGOd66BHk4Q4xxg2m/pzMQ9lQ8qCoc2dUAE root@k8s-master-160.kvm.io
The key's randomart image is:
+---[RSA 2048]----+
| Eo** ..++. |
| + *+*+o=+o |
|. + *oooBo . |
| . . *==. |
| . =oS+ |
| . .*... |
| o ..o . |
| o . |
| |
+----[SHA256]-----+
分发秘钥,别忘了给本机发一个
#分配给本机一个秘钥
~]# ssh-copy-id -i .ssh/id_rsa.pub root@IP
#拷贝到其他节点上 ,如果提示未找到.ssh目录,到/root下创建
~]# scp -p .ssh/authorized_keys .ssh/id_rsa{,.pub} root@IP:/root/.ssh/
~]# scp -p .ssh/authorized_keys .ssh/id_rsa{,.pub} root@IP:/root/.ssh/
~]# scp -p .ssh/authorized_keys .ssh/id_rsa{,.pub} root@IP:/root/.ssh/
网友评论