如何在Cygwin中安装并配置SSH

2025-03-26 04:22:23
推荐回答(2个)
回答1:

你参考一下这个信息: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

回答2:

Cygwin安装OpenSSH,可使用apt-cyg包管理器快速安装。apt-cyg install openssh配置O... $ ssh-host-config * Info: Generating /etc/ssh_host_key * Info: Generating /etc/ssh_host_r