在Win7下Cygwin中,使用ssh localhost命令,出现Connection closed by 127.0.0.1的问题。
解决方案:
1、开始——运行——services.msc
2、右键CYGWIN sshd——属性——登录选项卡——选择“此账户”——浏览——高级——立即查找——选择你的账户名(必须为管理员权限)——输入密码(必须要有,空密码不接受)——确定。
3、重启CYGWIN sshd服务即可。
这样就以你的账户的名义启动了这个服务。而后ssh localhost成功。
这样做的一个缺点可能是你要给电脑设个密码。
你参考一下这个信息:ssh-host-config#引导SSH服务配置***Info:Generating/etc/ssh_host_key***Info:Generating/etc/ssh_host_rsa_key***Info:Generating/etc/ssh_host_dsa_key***Info:Creatingdefault/etc/ssh_configfile***Info:Creatingdefault/etc/sshd_configfile***Info:PrivilegeseparationissettoyesbydefaultsinceOpenSSH3.3.***Info:However,thisrequiresanon-privilegedaccountcalled'sshd'.***Info:Formoreinfoonprivilegeseparationread/usr/share/doc/openssh/README.privsep.***Query:Shouldprivilegeseparationbeused?(yes/no)yes#输入yes***Info:Updating/etc/sshd_configfile***Warning:Thefollowingfunctionsrequireadministratorprivileges!***Query:Doyouwanttoinstallsshdasaservice?***Query:(Say"no"ifitisalreadyinstalledasaservice)(yes/no)yes#输入yes***Info:NotethattheCYGWINvariablemustcontainatleast"ntsec"***Info:forsshdtobeabletochangeusercontextwithoutpassword.***Query:EnterthevalueofCYGWINforthedaemon:[ntsec]ntsec#输入ntsec***Info:OnWindowsServer2003,WindowsVista,andabove,the***Info:SYSTEMaccountcannotsetuidtootherusers--acapability***Info:sshdrequires.Youneedtohaveortocreateaprivileged***Info:account.Thisscriptwillhelpyoudoso.***Info:YouappeartoberunningWindows2003Serverorlater.On2003and***Info:latersystems,it'snotpossibletousetheLocalSystemaccount***Info:forservicesthatcanchangetheuseridwithoutanexplicitpassword***Info:(suchaspasswordlesslogins[e.g.publickeyauthentication]viasshd).***Info:Ifyouwanttoenablethatfunctionality,it'srequiredtocreateanew***Info:accountwithspecialprivileges(unlessasimilaraccountalreadyexists).***Info:Thisaccountisthenusedtorunthesespecialservers.***Info:Notethatcreatinganewuserrequiresthatthecurrentaccounthave***Info:Administratorprivilegesitself.***Info:Noprivilegedaccountcouldbefound.***Info:Thisscriptplanstouse'cyg_server'.***Info:'cyg_server'willonlybeusedbyregisteredservices.***Query:Doyouwanttouseadifferentname?(yes/no)no#输入no,不指定启动用户***Query:Createnewprivilegeduseraccount'cyg_server'?(yes/no)no#输入no,不指定启动用户***ERROR:Therewasaseriousproblemcreatingaprivilegeduser.***Query:Doyouwanttoproceedanyway?(yes/no)yes#输入yes***Warning:Expectedprivilegeduser'cyg_server'doesnotexist.***Warning:Defaultingto'SYSTEM'***Info:ThesshdservicehasbeeninstalledundertheLocalSystem***Info:account(alsoknownasSYSTEM).Tostarttheservicenow,call***Info:`netstartsshd'or`cygrunsrv-Ssshd'.Otherwise,it***Info:willstartautomaticallyafterthenextreboot.***Info:Hostconfigurationfinished.Havefun!Administrator@backup~$cygrunsrv.exe-Ssshd#启动SSH服务14.安装完成后,检查一下系统服务中是否有CYGWINsshd服务,无启动帐号.15.检查系统用户sshd是否已启用,并属于管理员组.16.一切正常,即可启动ssh服务.登录的用户名是sshd,密码是sshd用户的密码.注意:使用windows用户本地认证mkpasswd-l>/etc/passwd使用windows用户的密码mkgroup-l>/etc/group使用windows用户组配置完成后,你可以使用SecureCRT或者putty等软件登陆连接ssh欢迎分享,转载请注明来源:内存溢出
评论列表(0条)