SSH 免密登录VPS

执行如下:

ssh-keygen.exe

接连出现如下提示

Generating public/private rsa key pair.
Enter file in which to save the key (/home/Jacquin/.ssh/id_rsa):   按Enter
/home/Jacquin/.ssh/id_rsa already exists.
Overwrite (y/n)? y  按y
Enter passphrase (empty for no passphrase): 按Enter
Enter same passphrase again:  按Enter
Your identification has been saved in /home/Jacquin/.ssh/id_rsa.
Your public key has been saved in /home/Jacquin/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:Q/rPE3lsnPZoFFwk3NzOiltRHhPG9djZCchidIT64TU Jacquin@cjq
The key's randomart image is:
+---[RSA 2048]----+
| ..++o=o++|
| +.o..**B|
| + .. ..B*|
| + . Eo . +|
| . S o+.+ o |
| . +o X o |
| . * = |
| o. + . |
| oo |
+----[SHA256]-----+

输入如下:

ssh-copy-id root@***.**.***.*** -p 端口号

/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@***.***.***.***'s password:  输入密码

出现如下信息

Number of key(s) added: 1

Now try logging into the machine, with: "ssh -p '端口号' 'root@***.***.***.***'"
and check to make sure that only the key(s) you wanted were added.

设置免密登录成功。

posted on 2018-08-10 14:17  吾乃青帝  阅读(836)  评论(0编辑  收藏  举报