`
lusterfly
  • 浏览: 98831 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

win7下安装cygwin及配置问题解决

 
阅读更多

cygwin安装成功后,连接 ssh localhost,一直出现

cygwin Connection closed by ::1的错误,费了很多时间查找,总算解决了,原文如下:

 

在google上看到cygwin的一个官方mail问答。参考Installing the Cygwin SSH daemon 。问题关键就是一个特殊的权限问题,在SYSTEM账户下运行的sshd服务需要有改变user id的特权(关于权限的问题,在cygwin的/usr/share/doc/Cygwin/openssh.README 中已经说得很明确了:2003 Server has a funny new feature.  When starting services under SYSTEM  account, these services have nearly all user rights which SYSTEM holds...except for the "Create a token object" right, which is needed to allow public key authentication :-( )。所以事件日志会有seteuid的错误。

至于解决方案,就是让cygwin帮你创建两个特殊用户sshd和cyg_server,其中sshd服务在cyg_server用户下运行,cyg_server有相应的权限(在/usr/share/doc/Cygwin/openssh.README 中也有说明)。

***** 关键的就是这两个用户都要创建。


 

在配置的时候注意一下几点:

1.当屏幕显示关于“privilege seperation”,输入yes后回车;

当屏幕显示关于“create local user sshd”,输入yes后回车;

*** Query: Should privilege separation be used? (yes/no) yes #输入yes

*** Info: Updating /etc/sshd_config file

*** Warning: The following functions require administrator privileges!

*** Query: Do you want to install sshd as a service?

*** Query: (Say "no" if it is already installed as a service) (yes/no) yes #输入yes

*** Info: Note that the CYGWIN variable must contain at least "ntsec"

*** Info: for sshd to be able to change user context without password.

*** Query: Enter the value of CYGWIN for the daemon: []

*** Info: On Windows Server 2003, Windows Vista, and above, the

设置的 cyg_server密码要记清楚,在win的服务里面用这个用户启动ssh服务,密码和这里设置的要一样

2. ssh-host-config重新配置

如果初始配置错误,大部分网上都建议全部删除再重新安装,但cygwin一旦安装很难完全卸载,只需要把ssh服务停止再重新执行这个命令,再把之前的覆盖掉就可以。

步骤:1.sc delete sshd

             2.系统重启,就再配置就ok了

3.*** 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) no
*** Query: Create new privileged user account 'cyg_server'? (yes/no) yes
*** Info: Please enter a password for new user cyg_server.  Please be sure
*** Info: that this password matches the password rules given on your system.
*** Info: Entering no password will exit the configuration.
*** Query: Please enter the password:
*** Query: Reenter:

4.执行ssh的key-keygen生成密钥文件,进行免密码登陆后,执行和退出界面如下。



 

<!--EndFragment-->
  • 大小: 185.1 KB
  • 大小: 45.8 KB
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics