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

1、准备ssh-copy-id

brew install ssh-copy-id

2、生成私钥公钥

ssh-keygen -t rsa -b 1024

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

ssh-copy-id -i 公钥 [email protected]

4、在本地~/.ssh/config文件中添加(如果没有则新建)

Host git.oschina.net

IdentityFile ~/.ssh/weiwei.sun

 

Host 192.168.50.100

IdentityFile ~/.ssh/weiwei.sun

猜你喜欢

转载自sundful.iteye.com/blog/2274948