git config --global credential.helper store
1.安装Cygwin:http://www.cygwin.com/ 可以不选择openssh安装包
2.手动安装OpenSSH:http://www.mls-software.com/opensshd.html
3.Cygwin运行OpenSSH配置文件:ssh-host-config
4.
5.测试:ssh -p 22 Administrator:xx.xx.xx.xx
6.设置$HOME/.ssh/authorized_keys
如果没有执行ssh-****** -t rsa
cat zhouleizhao.pub >> $HOME/.ssh/authorized_keys
7.How to use Public Key exchange on Windows OpenSSH (sshd)
- A number of people have asked how to setup public key support for opensshd.
Due to the occasional emails I've received on the topic, I wanted to figure it out myself.
It turns out to be pretty easy to do and requires only a few changes
- Make sure you have installed openssh with the following options
- Install under the SSHD_SERVER account (you should also set the password to something other than the default)
- Choose SSHD privilege seperation - Yes
- Modify /etc/sshd_conf
- StrictModes no
- PubkeyAuthentication yes
- AuthorizedKeysFile .ssh/authorized_keys
- If you modified /etc/sshd_conf, from an administrator cmd prompt or using the service control manager
- net stop opensshd
- net start opensshd
- On the client, execute
- ssh-****** -t dsa
- then copy id_dsa.pub to $HOME/.ssh/authorized_keys on the server (and remove id_dsa.pub from the $HOME/.ssh on the client)
- To summarize:
- id_dsa should be in the client $HOME/.ssh/id_dsa
- id_dsa.pub should be in the server $HOME/.ssh/authorized_keys file (if your id_dsa.pub is the only entry you can just call the file authorized_keys, if it isn't the only entry, then append it to authorized_keys)
- On the client, attempt to
- connect to the server: 'ssh [email protected]' where you should be prompted for the private key password and then connected
- Make sure you have installed openssh with the following options
8.设置文件和目录权限:
设置authorized_keys权限
$ chmod 600 authorized_keys
设置.ssh目录权限
$ chmod 700 -R .ssh
9.要保证.ssh和authorized_keys都只有用户自己有写权限。否则验证无效。(今天就是遇到这个问题,找了好久问题所在),其实仔细想想,这样做是为了不会出现系统漏洞。