cygwin安装成功后, 在管理员特权下执行bash终端. 我们先对git server端进行设置.
执行ssh-host-config, 接下来脚本会引导用户进行设定.
1. *** Query: Should StrictModes be used? (yes/no)
这里选择yes
2. *** Query: Should privilege separation be used? (yes/no)
这里选择yes, Cygwin会为我们建立一个特殊的windows账户用来执行sshd服务.
3. *** Query: Do you want to install sshd as a service?
*** Query: (Say "no" if it is already installed as a service) (yes/no)
选择yes, 会注册一个sshd的服务, 以执行server.
4. *** Query: Enter the value of CYGWIN for the daemon: []
这里写ntsec
5. *** Info: This script plans to use 'cyg_server'.
*** Info: 'cyg_server' will only be used by registered services.
*** Query: Do you want to use a different name? (yes/no)
Cygwin要建立一个cyg_server账户以运行sshd服务, 这里可以选择为该账户另取名字或者使用default. 我们选择no.
6. *** Query: Create new privileged user account 'DMC-PC\cyg_server' (Cygwin name: 'cyg_server')? (yes/no)
yes, 确定建立账户. 之后输入密码, 完成config.
设定完毕后, 在/etc下面多出来一个sshd_config文件, 打开该文件, 将如下item的注释取消,
RSAAuthentication yes
PubkeyAuthentication yes
新版的openssh原配置文件可能并没有RSAAuthentication这行,我是自己加上了它,还没测试是否对使用有影响。
openSSH配置完毕之后,在cygwin终端输入:
net stop sshd
net start sshd
即可重启sshd服务。如果出现了什么错误,可以到服务端windows事件日志里查看错误详细信息。