通过SSH连接到VMware Server控制台

Has this ever happened to you? I created a new virtual machine running Ubuntu on my VMware server before I left home, but forgot to install the ssh server… so I couldn’t get to that machine at all from my remote location. Rather than driving back home I decided to find a solution.

你曾经发生过这些事情吗? 离开家之前,我在VMware服务器上创建了一个运行Ubuntu的新虚拟机,但是却忘记了安装ssh服务器……所以我根本无法从远程位置访问该计算机。 与其开车回家,我决定找到一个解决方案。

After a bit of research I discovered that the console communicates on port 902, so I added a port-forwarding rule to an ssh tunnel and was able to easily get on the console and install openssh.

经过一番研究,我发现控制台在端口902上进行通信,因此我向ssh隧道添加了端口转发规则,并且能够轻松进入控制台并安装openssh。

Port Forwarding with ssh Command

使用ssh命令进行端口转发

In order to open a local port below 1024 you will need to run this command as root, or by using sudo. This will open the local port 902 on your client machine and then forward the connection to the server specified by hostname.com.

为了打开低于1024的本地端口,您将需要以root身份或使用sudo运行此命令。 这将打开客户端计算机上的本地端口902,然后将连接转发到hostname.com指定的服务器。

sudo ssh -L 902:localhost:902 username@hostname.com

须藤ssh -L 902:localhost:902 username@hostname.com

At this point you can skip to the last section in the article.

此时,您可以跳到文章的最后一节。

Port Forwarding with SecureCRT

使用SecureCRT进行端口转发

If you use SecureCRT under Windows like I do, just open up your session options and find Port Forwarding in settings and click the Add button for a new forwarded connection.

如果像我一样在Windows下使用SecureCRT,只需打开会话选项并在设置中找到“端口转发”,然后单击“添加”按钮以建立新的转发连接。

image

Enter in a name, and use 902 for both of the Port fields as shown below:

输入名称,并在两个“ Port”字段中使用902,如下所示:

image

Logging into the Console

登录控制台

Bring up your locally installed VMware Server Console, and use localhost for the Remote host name. You can’t use the “Local host” radio button because it will attempt to connect directly to the service… we want to connect over the SSH tunnel.

调出本地安装的VMware Server控制台,并使用localhost作为远程主机名。 您不能使用“本地主机”单选按钮,因为它会尝试直接连接到服务…我们要通过SSH隧道进行连接。

image

And there you are… logged onto your console.

在那里……您登录到控制台。

image

Notes

笔记

  • The server console itself should work fairly well, but if you try and get onto the actual console of one of the virtual machines you should make sure you have a really fast connection… otherwise it’s slower than dirt.

    服务器控制台本身应该可以很好地工作,但是如果您尝试进入其中一台虚拟机的实际控制台,则应确保连接速度非常快……否则它的速度会比运行速度慢。
  • I’d really only use this for powering machines on/off, or changing the settings.

    我真的只将其用于打开/关闭机器电源或更改设置。
  • You might potentially have to change your local firewall settings to allow the port.

    您可能必须更改本地防火墙设置以允许端口。
  • Putty users should be able to easily adapt the settings above to work for them.

    腻子用户应该能够轻松调整上面的设置以适合他们。

翻译自: https://www.howtogeek.com/howto/linux/connect-to-vmware-server-console-over-ssh/

### 回答1: 在 VMware 中启动 Debian 系统后,打开终端并输入以下命令: sudo apt-get update sudo apt-get install openssh-server sudo service ssh start 第一条命令用于更新软件包列表,第二条命令用于安装 openssh-server,第三条命令用于启动 SSH 服务。然后,在 VMware 中打开网络设置,将网络模式更改为“桥接”,这样就可以在主机上使用 ssh 客户端连接到虚拟机的 SSH 服务了。 ### 回答2: 要在VMware的Debian系统中开启ssh,可以按照以下步骤进行设置: 1. 首先,在VMware中启动Debian虚拟机并登录到系统。 2. 打开终端(Terminal)或控制台窗口。 3. 使用root权限运行以下命令来安装ssh服务器软件:sudo apt-get install openssh-server 4. 安装完成后,打开sshd配置文件,可以使用以下命令:sudo nano /etc/ssh/sshd_config 5. 在配置文件中,找到并编辑以下行(如果没有找到可以添加): Port 22 # 修改为所需的端口号,默认是22 PermitRootLogin yes # 允许root用户登录(可选) 6. 完成后,按Ctrl + X退出编辑,保存更改。 7. 运行以下命令来重新加载ssh服务器配置:sudo service ssh restart 8. 确保防火墙允许ssh连接。如果有防火墙软件运行,请确保端口号已在防火墙规则中打开。 现在,你的VMware的Debian系统已经开启了ssh服务。你可以使用其他计算机上的ssh客户端来连接到这台虚拟机。 请确保客户端和虚拟机在同一网络中,并使用虚拟机的IP地址或主机名连接
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值