该步骤必须在root用户下执行,若以普通系统用户登录,需要执行su切换到root用户下执行后续操作。
1 | ssh-keygen -t rsa -b 4096 |
过程中需要:
回显信息如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | Generating public/private rsa key pair. Enter file in which to save the key (/root/.ssh/id_rsa): /root/.ssh/id_rsa already exists. Overwrite (y/n)? y 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:g8T/XaRUqANpuIjxnI34In89+R68QckZPw7eyEaCU+o root@host11 The key's randomart image is: +---[RSA 4096]----+ | . . .. | | . .. + .. | | * =+o.. .. . | | o *=o+ =o. o | | .+ o S o.. . | |. .... B B o . | | o .E. .O + . | | . . +. + | | . ++ | +----[SHA256]-----+ |
1 | ssh-copy-id -i /root/.ssh/id_rsa.pub root@Server IP |
过程中需要输入节点服务器对应用户的密码。
1 | cp /root/.ssh/id_rsa /home/devkit |
1 | chown devkit:devkit /home/devkit/id_rsa |