首先,說實在的,這個已經被不少人說過了,可是,我是第一次用,沒錯,我就是這麼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