简体   繁体   English

连接到 Windows SSH 服务器

[英]Connecting to Windows SSH Server

I am a newbie trying out SSH.我是一个尝试 SSH 的新手。 The scenario is I have 2 machines - Windows 7 PC(Desktop) and a VMWare machine (Windows 7).场景是我有 2 台机器 - Windows 7 PC(台式机)和一台 VMWare 机器(Windows 7)。 Cygwin installed on both. Cygwin 安装在两者上。 I am trying to connect the VMWare machine to the desktop.我正在尝试将 VMWare 机器连接到桌面。 I have installed the OpenSSH server on Desktop server.我已经在桌面服务器上安装了 OpenSSH 服务器。 I verified it is running, using netstat.我使用 netstat 验证它正在运行。 I modified the Windows firewall, by adding to the Inbound Rules to allow connections for port 22.我修改了 Windows 防火墙,添加到入站规则以允许端口 22 的连接。

My problem is I am unable to connect from the VMWare machine.我的问题是我无法从 VMWare 机器连接。

$ ssh -v user_name@my_machine
OpenSSH_5.5p1, OpenSSL 0.9.8q 2 Dec 2010
debug1: Connecting to my_machine port 22.
debug1: connect to address my_machine port 22: Connection refused
ssh: connect to host my_machine port 22: Connection refused

What am I doing wrong?我做错了什么? What are my options to configure?我有哪些配置选项? Any links or answers would be helpful.任何链接或答案都会有所帮助。

Thank you.谢谢。

WM西马

Open your command prompt and run the following command: ssh -v Your_User_Name@Your_IP_Address打开命令提示符并运行以下命令:ssh -v Your_User_Name@Your_IP_Address

If response is: OpenSSH_for_Windows_7.7p1, LibreSSL 2.6.5 debug1: Connecting to Your_IP_Address port 22. debug1: connect to address Your_IP_Address port 22: Connection refused ssh: connect to host Your_IP_Address port 22: Connection refused如果响应是:OpenSSH_for_Windows_7.7p1,LibreSSL 2.6.5 debug1:连接到 Your_IP_Address 端口 22。debug1:连接到地址 Your_IP_Address 端口 22:连接被拒绝 ssh:连接到主机 Your_IP_Address 端口 22:连接被拒绝

Then go to the Windows Service called OpenSSH SSH Server is started and running, it is set to manual start as default so it will not be running unless you have started it.然后转到名为 OpenSSH 的 Windows 服务 SSH 服务器已启动并正在运行,它默认设置为手动启动,因此除非您已启动它,否则它不会运行。

Now run above command again.现在再次运行上面的命令。 SSH command will connect to the user. SSH 命令将连接到用户。

If the ssh server on the Desktop is accessible in the localhost then try this如果可以在本地主机中访问桌面上的 ssh 服务器,请尝试此操作

Desktop <- Desktop Firewall <- VM Firewall <- VM桌面 <- 桌面防火墙 <- 虚拟机防火墙 <- 虚拟机

Try shutting down the firewalls in between one by one to check where the issue starts after then configure accordingly.尝试一一关闭防火墙以检查问题从哪里开始,然后进行相应配置。 Remember that the Desktop Firewall rules should be inbound and the VM Firewall is outbound请记住,桌面防火墙规则应该是入站规则,而虚拟机防火墙是出站规则

You should make sure that my_machine allows inbound connection.您应该确保 my_machine 允许入站连接。 Check the firewall....检查防火墙....

(if you can run this command locally - but not from the other machine it might be that case). (如果您可以在本地运行此命令 - 但不能从另一台机器运行,则可能是这种情况)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM