首先,说实在的,这个已经被不少人说过了,可是,我是第一次用,没错,我就是这么outbash
首先生成一个rsa秘钥 ssh-keygen -t rsa
以后把这个秘钥拷贝到远程主机上,用下面这个命令就够了 ssh-copy-id root@vultr.bboysoul.com
ssh
➜ ~ ssh-copy-id root@vultr.bboysoul.com /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@vultr.bboysoul.com's password: Number of key(s) added: 1 Now try logging into the machine, with: "ssh 'root@vultr.bboysoul.com'" and check to make sure that only the key(s) you wanted were added.
以后你就能够免密登陆了code
欢迎关注Bboysoul的博客www.bboysoul.com Have Funblog