Closed XiangyunHuang closed 4 years ago
本地主机生成 ssh 密钥对,将公钥传递给远程服务器/本地虚拟机,本地配置 ~/.ssh/config
ssh-copy-id -i ~/.ssh/id_rsa_github 登陆虚拟机的账户名@虚拟机IP地址
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/Users/xiangyun/.ssh/id_rsa_github.pub"
/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
登陆虚拟机的账户名@虚拟机IP地址's password:
Number of key(s) added: 1
Now try logging into the machine, with: "ssh '登陆虚拟机的账户名@虚拟机IP地址'"
and check to make sure that only the key(s) you wanted were added.
最佳搭档:利用 SSH 及其配置文件节省你的生命 https://liam.page/2017/09/12/rescue-your-life-with-SSH-config-file/
适合需要管理多台服务器,连接多台虚拟机,本地生成 SSH Key 将公钥传递给虚拟机和远程服务器,实现无密码登陆远程主机或虚拟机