ssh-keygen
生成 key,默认在位置 .ssh
ssh-keygen -C 'vultr'
将 key 复制到服务器
ssh-copy-id -i ~/.ssh/keyname.pub root@hostname
ssh-copy-id root@45.76.163.216
ssh-copy-id -i ~/.ssh/vultr.pub root@45.76.163.216
在本地编辑 ssh config,可以直接用前面命名的服务器名来登陆
vim ~/.ssh/config
Host vultr
Hostname hostname
User root
Port 22
IdentityFile ~/.ssh/vultr
若出现Host key verification failed
ssh-keygen -R hostname
ssh root@45.77.27.58
ssh-keygen -R 45.77.27.58
网友评论