Created
August 5, 2013 07:21
-
-
Save swpu-lee/6154034 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1、新建一个sshkey(依次输入保存到哪个文件、密码、重复密码,例子中假设文件为:~/.ssh/22_rsa): | |
ssh-keygen | |
2、把公钥copy到服务器上去: | |
因为在osx下没有ssh-copy-id,所以采用如下方法获得一个ssh-copy-id命令 | |
sudo curl 'https://raw.github.com/gist/1639381/eea46277ba544fcbd0a0768e8b3f854880ddb772/ssh-copy-id' -o /usr/bin/ssh-copy-id | |
sudo chmod 777 /usr/bin/ssh-copy-id | |
ssh-copy-id '-p 22055 user@remote.example.com' | |
3、把私钥添加到本地钥匙串访问(Keychain Access) | |
ssh-add -K ./22_rsa | |
添加完成后可以在:“应用程序=>钥匙串访问=>登录”中找到名称以“SSH: ”开头的钥匙串,以后如果换密码,就在这里把旧的删了即可 | |
4、现在登录已经不需要密码了 | |
参考: | |
基本使用: | |
http://www.thegeekstuff.com/2008/11/3-steps-to-perform-ssh-login-without-password-using-ssh-keygen-ssh-copy-id/ | |
ssh为非22端口时使用ssh-copy-id上传密码: | |
http://superuser.com/questions/446665/how-to-use-ssh-copy-id-on-a-non-standard-port | |
osx没得ssh-copy-id: | |
http://blog.campodoro.org/?p=241 | |
添加到服务器上后,ssh仍需要密码: | |
http://superuser.com/questions/88470/how-to-use-mac-os-x-keychain-with-ssh-keys |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment