mac 上使用ssh-copy-id 上传公钥 实现不输入密码登陆

一、准备ssh-copy-id 服务器

brew install ssh-copy-id ssh

二、生成私钥公钥 spa

ssh-keygen -t rsa -b 1024 it

三、将公钥上传致服务器(~/.ssh/authorized_keys) io

ssh-copy-id -i 公钥 root@192.168.1.xxx email

四、在本地~/.config文件中添加(若是没有则新建) rsa

Host xxx
  HostName 192.168.1.xxx
  User root
  PreferredAuthentications publickey
  IdentityFile ~/.ssh/私钥 im

ssh-keygen  -t dsa –C user.email –f  ~/.ssh/user.email ssh-key

相关文章
相关标签/搜索