Cygwin
CYGWIN sshd“埠 22:連接被拒絕”
Google搜尋到死,無法解決。我無法從另一台機器連接到我的 CYGWIN sshd。Netstat 顯示連接已建立。可以本地連接,沒問題。
[oracle@aserver ~]$ ssh myid@mycomp ssh: connect to host mycomp port 22: Connection refused
在 mycomp 上:
$ netstat -a | grep ssh TCP MYCOMP:ssh MYCOMP.mydomain.com:0 LISTENING TCP MYCOMP:1161 aserver.mydomain.com:ssh ESTABLISHED
從本地主機成功登錄:
$ ssh myid@mycomp myid@mycomp's password: Last login: Tue Sep 14 14:27:30 2010 from mycomp.mydomain.com Fanfare!!! You are successfully logged in to this server!!!
我在 XP sp3 上,今天更新了 CYGWIN。嘗試清理和重新配置,沒有幫助。
清理(歸功於 Herb Maeder http://www.cygwin.com/ml/cygwin/2008-10/msg00370.html):
# Remove sshd service cygrunsrv --stop sshd cygrunsrv --remove sshd # Delete any sshd or related users (such as cyg_server) from /etc/passwd # (use your favorite editor) # Delete any sshd or relaged users (such as cyg_server) from the system net user sshd /delete
配置:
$ 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: Overwrite existing /etc/inetd.d/sshd-inetd file? (yes/no) yes *** Info: Creating default /etc/inetd.d/sshd-inetd file *** Info: Updated /etc/inetd.d/sshd-inetd *** 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 *** Query: Enter the value of CYGWIN for the daemon: [] *** Info: The sshd service has been installed under the LocalSystem *** Info: account (also known as SYSTEM). To start the service now, call *** Info: `net start sshd' or `cygrunsrv -S sshd'. Otherwise, it *** Info: will start automatically after the next reboot. *** Info: Host configuration finished. Have fun! myid@MYCOMP /cygdrive/c/Documents and Settings/myid $ cygrunsrv -S sshd myid@MYCOMP /cygdrive/c/Documents and Settings/myid $ cygrunsrv -Q sshd Service : sshd Display name : CYGWIN sshd Current State : Running Controls Accepted : Stop Command : /usr/sbin/sshd -D
你能從另一台電腦telnet到22埠嗎?
telnet <mycomp> 22
如果您的連接被拒絕(並且您可以通過 localhost 進行連接),這絕對是防火牆問題。除了 Windows 防火牆之外還有其他防火牆——McAfee、ZoneAlarm 等,聽起來你被阻止了——因為你可以在內部訪問它(表明它在正確的埠上偵聽)但你不能在外部訪問它(表示外部埠已關閉)。
令人驚訝的是,Mozilla 在配置防火牆方面非常出色——包括 Windows 防火牆。試試看。僅僅因為你認為沒有防火牆在執行——並不意味著沒有。