六狼论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博账号登陆

只需一步,快速开始

搜索
查看: 1706|回复: 0

Windows 下安装 SSH 服务

[复制链接]

升级  30%

23

主题

23

主题

23

主题

秀才

Rank: 2

积分
95
 楼主| 发表于 2013-2-7 05:46:22 | 显示全部楼层 |阅读模式
http://codingdao.com/wp/post/win-install-ssh/
 
 

<span style="color: #313428; font-family: Verdana, Tahoma, 'BitStream vera Sans', Arial, Helvetica, sans-serif; font-size: 14px; letter-spacing: 1px; line-height: 21px;">
 
我想用SSH远程访问Windows系统,先是在SourceForge上找到了Linux下标准的OpenSSH (sshd) 的Windows移植版,不过发现难配置,原因是我装了MSYS/MinGW和Cygwin这2个Unix工具集,不知OpenSSH的配置和哪个冲突,导致无法启动sshd服务程序。
几款Windows下的SSH服务软件  


  • KpyM Telnet/SSH Server
    采用BSD许可证的开源软件。支持SSH、Telnet、SFTP协议。
  • MobaSSH
    有Home和Professional 2个版本,后者需付费注册。支持SSH、SFTP、SCP协议。
  • WinSSHD
    30天评估试用期,Personal版是免费的。支持SSH、VNC、SFTP、SCP协议。
我试用了KpyM的SSH服务软件,安装、配置、运行很简单上手,不过还是想用OpenSSH,毕竟在Linux下用它,很脸熟嘛,帮助、说明也多。然后在这里发现原来Cygwin工具集中就包含OpenSSH,(-_-^)!
配置Cygwin中的OpenSSH  

<ol style="padding: 0px; margin: 0px;"><li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 2em; padding: 0px;">通过Cygwin的安装程序安装完OpenSSH后,将系统环境变量CYGWIN置为ntsec(默认是tty),建议Cygwin使用Windows的安全规则。
<li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 2em; padding: 0px;">将sshd所在目录加入Cygwin Shell环境的PATH变量中:在登录Shell的全局初始化脚本/etc/profile里的PATH中加入路径即可,我这里是/usr/sbin,因为Cygwin默认安装后只向PATH中加入bin类型的路径,而不加入sbin类型的路径。
<li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 2em; padding: 0px;">Cygwin Shell下运行ssh-host-config,配置时有提示问题,在提示问题:"CYGWIN="时,回答ntsec
<li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 2em; padding: 0px;">ssh-host-config运行可能会失败,原因是:/、/usr/bin、/usr/lib等Unix目录必须以system方式挂载(默认是以user方式挂载),执行类似下列命令即可以system方式挂载这些目录:
<div style="margin-top: 1em !important; margin-right: 0px !important; margin-bottom: 1em !important; margin-left: 0px !important; background-image: none !important; background-color: #ffffff !important; text-align: left !important; float: none !important; vertical-align: baseline !important; height: auto !important; width: 653px; line-height: 1.1em !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-weight: normal !important; font-style: normal !important; font-size: 1em !important; direction: ltr !important; padding: 0px !important; border: 1px !important solid !important #e0e0e0 !important;" class="syntaxhighlighter  "><div style="background-image: none !important; background-color: initial !important; text-align: left !important; float: none !important; vertical-align: baseline !important; height: auto !important; width: auto !important; line-height: 1.1em !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-weight: normal !important; font-style: normal !important; font-size: 1em !important; direction: ltr !important; padding: 0px !important; margin: 0px !important;" class="lines"><div style="background-image: none !important; background-color: #ffffff !important; text-align: left !important; float: none !important; vertical-align: baseline !important; height: auto !important; width: auto !important; line-height: 1.1em !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-weight: normal !important; font-style: normal !important; font-size: 1em !important; direction: ltr !important; padding: 0px !important; margin: 0px !important;" class="line alt1">
1mount -f -s -b "[Windows path to Cygwin]/" "/"
您需要登录后才可以回帖 登录 | 立即注册 新浪微博账号登陆

本版积分规则

快速回复 返回顶部 返回列表