Accessing the virtual machine via SSH

We have successfully connected to the Terminal console provided to us by VirtualBox. However, this Terminal connection is really basic: for example, we can't scroll up, we can't paste copied text, and we do not have colored syntax highlighting. Fortunately for us, we have a nice alternative: the Secure Shell (SSH) protocol. SSH is used to connect to the running shell on the virtual machine. Normally, this would be done over the network: this is how enterprises maintain their Linux servers. In our setup, we can actually use SSH within our host machine, using the power forwarding we set up earlier.

If you followed the installation guide, port 2222 on the host machine should be redirected to port 22 on the virtual machine, the port where the SSH process is running. From a Linux or macOS host machine, we can connect using the following command (substitute the username or port number if necessary):

$ ssh reader@localhost -p 2222

However, there is a good chance you're running Windows. In that case, you will probably not have access to a native SSH client application within Command Prompt. Luckily, there are many good (and free!) SSH clients. The simplest and most well-known client is PuTTY. PuTTY was created in 1999 and, while it's definitely a very stable client, its age is starting to show. We would recommend some newer SSH client software, such as MobaXterm. This provides you with more session management, a better GUI, and even a local Command Prompt!

Whichever software you decide on, be sure to use the following values (again, change the port or username if you deviated from the installation guide):

  • Host Name: localhost
  • Port: 2222
  • User Name: reader
If you're using SSH to connect to your virtual machine, you can start it headless. When you do this, VirtualBox will not create a new window with the Terminal console for you, but instead runs the virtual machine in the background where you can still connect via SSH (just like what happens on actual Linux servers). This option, Headless Start, is found right below the earlier Normal Start, when right clicking on the machine and selecting Start.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.118.163.142