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,只需打开会话选项并在设置中找到“端口转发”,然后单击“添加”按钮以建立新的转发连接。
Enter in a name, and use 902 for both of the Port fields as shown below:
输入名称,并在两个“ Port”字段中使用902,如下所示:
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隧道进行连接。
And there you are… logged onto your console.
在那里……您登录到控制台。
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/