ssh-keygen

ssh-keygen

生成 key,默认在位置 .ssh

ssh-keygen -C 'vultr'

将 key 复制到服务器


ssh-copy-id -i ~/.ssh/keyname.pub root@hostname

ssh-copy-id [email protected]


ssh-copy-id -i ~/.ssh/vultr.pub [email protected]

在本地编辑 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 [email protected]

ssh-keygen -R 45.77.27.58

你可能感兴趣的:(ssh-keygen)