win8下sshd服务的安装

在安装Hadoop时需要安装sshd服务,此服务安装并非像书上所言那么容易,还是把我的安装经历分享出来吧。

【之前的尝试】

我是在win8 + cygwin64环境下安装sshd服务的,之前每一次安装在创建账户的环节总是会出错,后来才知道是管理员权限的问题,于是乎在cygwin图标上右键点击“以管理员模式运行”,遂解决问题。

【离成功接近的第一次尝试】

$ ssh-host-config

*** Query: Overwrite existing /etc/ssh_config file? (yes/no) no
*** Query: Overwrite existing /etc/sshd_config file? (yes/no) no

*** Query: Do you want to install sshd as a service?  得安装成一个服务啊!不然后面怎么启动sshd服务
*** Query: (Say "no" if it is already installed as a service) (yes/no) yes
*** Query: Enter the value of CYGWIN for the daemon: [] ChenSijie  不知道这是干嘛的。。。。望高手示之。
*** Info: On Windows Server 2003, Windows Vista, and above, the
*** Info: SYSTEM account cannot setuid to other users -- a capability
*** Info: sshd requires.  You need to have or to create a privileged
*** Info: account.  This script will help you do so.

*** Info: You appear to be running Windows XP 64bit, Windows 2003 Server,
*** Info: or later.  On these systems, it's not possible to use the LocalSystem
*** Info: account for services that can change the user id without an
*** Info: explicit password (such as passwordless logins [e.g. public key
*** Info: authentication] via sshd).

*** Info: If you want to enable that functionality, it's required to create
*** Info: a new account with special privileges (unless a similar account
*** Info: already exists). This account is then used to run these special
*** Info: servers.

*** Info: Note that creating a new user requires that the current account
*** Info: have Administrator privileges itself.

*** Info: No privileged account could be found.

*** 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) yes    
*** Query: Enter the new user name: chen
*** Query: Reenter: chen

*** Query: Create new privileged user account 'chen'? (yes/no) yes   我这里选择新起一个名字chen,大家可以随便起
*** Info: Please enter a password for new user chen.  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:

*** Info: User 'chen' has been created with password 'root'.     在使用管理员权限之后,终于可以创建用户chen成功了
*** Info: If you change the password, please remember also to change the
*** Info: password for the installed services which use (or will soon use)
*** Info: the 'chen' account.

*** Info: Also keep in mind that the user 'chen' needs read permissions
*** Info: on all users' relevant files for the services running as 'chen'.
*** Info: In particular, for the sshd server all users' .ssh/authorized_keys
*** Info: files must have appropriate permissions to allow public key
*** Info: authentication. (Re-)running ssh-user-config for each user will set
*** Info: these permissions correctly. [Similar restrictions apply, for
*** Info: instance, for .rhosts files if the rshd server is running, etc].


*** Info: The sshd service has been installed under the 'chen'
*** Info: account.  To start the service now, call `net start sshd' or
*** Info: `cygrunsrv -S sshd'.  Otherwise, it will start automatically
*** Info: after the next reboot.

*** Info: Host configuration finished. Have fun!   Have fun就是成功了!

在win+R弹出的运行框内输入services.msc,可以进入管理服务的界面(如图1);

或者,在我的电脑(抱歉我还是习惯这个名字,win8里面叫应该叫“计算机”,英文版系统叫“computer”)上按右键选择管理,然后在【服务和应用程序】中的【服务】里找到CYGWIN sshd,右击设置为启动。

图1


图2


然而,CYGWIN sshd服务却没有启动成功,提示【服务启动后停止。某些服务在未由其他服务或程序使用时将自动停止。】

看来系统还真养不下闲人。

图形界面不行,我就试试在cygwin中能否用命令开启服务

$ cygrunsrv --start sshd
cygrunsrv: Error starting a service: QueryServiceStatus:  Win32 error 1062: 

没成功,不过有了错误号就好办了,搜一搜~~


【离成功接近的第二次尝试】

http://www.cnblogs.com/dyllove98/p/3201064.html

cygrunsrv: Error starting a service: QueryServiceStatus: Win32 error 1062: 解决办法
问题原因:很可能是/var/log的权限设置不正确。首先执行 mkpasswd 和 mkgroup 重新生成权限信息,再删除sshd服务,重新配置

解决办法:

$ mkpasswd -l > /etc/passwd
$ mkgroup -l > /etc/group
$ cygrunsrv -R sshd   
$ ssh-host-config -y  重新安装sshd服务
$ cygrunsrv -S sshd   再次用命令启动服务


流程如下:
ChenSijie@Jeff ~
$ mkpasswd -l > /etc/passwd

ChenSijie@Jeff ~
$ mkgroup -l > /etc/group

ChenSijie@Jeff ~
$  cygrunsrv -R sshd

ChenSijie@Jeff ~
$ ssh-host-config -y

*** Query: Overwrite existing /etc/ssh_config file? (yes/no) yes
*** Info: Creating default /etc/ssh_config file
*** Query: Overwrite existing /etc/sshd_config file? (yes/no) yes
*** Info: Creating default /etc/sshd_config file
*** Info: Privilege separation is set to yes by default since OpenSSH 3.3.
*** Info: However, this requires a non-privileged account called 'sshd'.
*** Info: For more info on privilege separation read /usr/share/doc/openssh/README.privsep.
*** Query: Should privilege separation be used? (yes/no) yes
*** Info: Note that creating a new user requires that the current account have
*** Info: Administrator privileges.  Should this script attempt to create a
*** Query: new local account 'sshd'? (yes/no) yes
*** Info: Updating /etc/sshd_config file

*** Query: Do you want to install sshd as a service?
*** Query: (Say "no" if it is already installed as a service) (yes/no) yes
*** Query: Enter the value of CYGWIN for the daemon: []
*** Info: On Windows Server 2003, Windows Vista, and above, the
*** Info: SYSTEM account cannot setuid to other users -- a capability
*** Info: sshd requires.  You need to have or to create a privileged
*** Info: account.  This script will help you do so.

*** Info: You appear to be running Windows XP 64bit, Windows 2003 Server,
*** Info: or later.  On these systems, it's not possible to use the LocalSystem
*** Info: account for services that can change the user id without an
*** Info: explicit password (such as passwordless logins [e.g. public key
*** Info: authentication] via sshd).

*** Info: If you want to enable that functionality, it's required to create
*** Info: a new account with special privileges (unless a similar account
*** Info: already exists). This account is then used to run these special
*** Info: servers.

*** Info: Note that creating a new user requires that the current account
*** Info: have Administrator privileges itself.

*** Info: No privileged account could be found.

*** Info: This script plans to use 'cyg_server'.
*** Info: 'cyg_server' will only be used by registered services.
*** 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:

*** Info: User 'cyg_server' has been created with password 'root'.
*** Info: If you change the password, please remember also to change the
*** Info: password for the installed services which use (or will soon use)
*** Info: the 'cyg_server' account.

*** Info: Also keep in mind that the user 'cyg_server' needs read permissions
*** Info: on all users' relevant files for the services running as 'cyg_server'.
*** Info: In particular, for the sshd server all users' .ssh/authorized_keys
*** Info: files must have appropriate permissions to allow public key
*** Info: authentication. (Re-)running ssh-user-config for each user will set
*** Info: these permissions correctly. [Similar restrictions apply, for
*** Info: instance, for .rhosts files if the rshd server is running, etc].


*** Info: The sshd service has been installed under the 'cyg_server'
*** Info: account.  To start the service now, call `net start sshd' or
*** Info: `cygrunsrv -S sshd'.  Otherwise, it will start automatically
*** Info: after the next reboot.

*** Info: Host configuration finished. Have fun!

ChenSijie@Jeff ~
$ cygrunsrv -S sshd

最后终于成功启动了CYGWIN sshd服务


【附录】

如果以上情况都没解决问题,摘抄一下其它情况的解决方案(未验证)。

补充:
我是装了又装,还是无法启动sshd。
出现这个错误
cygrunsrv: Error starting a service: QueryServiceStatus: Win32 error 1062:
The service has not been started.
除了以上所说的,还有一个可能是cygwin1.dll冲突了。

在Windows事件查看器里看到以下信息:

事件 ID ( 0 )的描述(在资源( sshd )中)无法找到。本地计算机可能没有必要的注册信息或消息 DLL 文件来从远端计算机显示消息。您可能可以使用 /AUXSOURCE= 标识来检索词描述;查看帮助和支持以了解详细信息。下列信息是事件的一部分: sshd: PID 2124: `sshd' service started.

最后tail /var/log/sshd.log,看到里面有错误信息,Google之,发现以下文章
http://jansel.javaeye.com/blog/345653

cygwin安装问题,与cntlm冲突

关键字: cygwin cntlm
安装了好多次cygwin没有成功,始终在执行到17%或者97%的地方停住。最后只好在安全模式下安装,没有想到竟然成功了。

返回到正常启动模式,发现如下问题:

Error代码
*** fatal error - system shared memory version mismatch detected - 0x2D1E009C/ 0x8A88009C.
This problem is probably due to using incompatible versions of the cygwin DLL. Search for cygwin1.dll using the Windows Start->Find/Search facility
and delete all but the most recent version. The most recent version *should* reside in x:cygwinbin, where 'x' is the drive on which you have
installed the cygwin distribution. Rebooting is also suggested if you
are unable to find another cygwin DLL.

照着提示,把全部硬盘扫描了一遍,发现Cntlm竟然也用到了cygwin1.dll,不过版本比较低,是24的;而我自己安装的cygwin是25的,不兼容。把Cntlm的24版本替换为25版本之后,cygwin可以正常使用,Cntlm也MS没有问题。

一点感受:cygwin的错误提示做的真的不错。再想想自己的产品。

我没有装Cntlm,但用search everything查找,发现好多地方有cygwin1.dll
D:dig
D:APMServ5.2.6nginx
D:APMServ5.2.6shell
其中D:dig加到了PATH中,估计是这个cygwin1.dll比较旧导致的。
把D:dig从PATH中移除,重启XP就可以启动了。



设置无密码登录的方案

http://blog.csdn.net/cybercode/article/details/7080743

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值