Well, in this blog I would be talking about doing a secure
shell login into a Guest Linux machine in Oracle VirtualBox. Secure shell is
basically a network protocol for operating network services securely over an
unsecured network. Since most of us generally interact with Linux servers using
ssh login, it pays to test this out on a Virtual machine since we have both a
physical login and a remote login configured. For this demo, I would be using a
Fedora 23 Linux server and putty as my ssh client…
Detail about SSH can be found here(https://en.wikipedia.org/wiki/Secure_Shell
) and for putty you can check out these links (https://en.wikipedia.org/wiki/PuTTY)
and download link (http://www.putty.org/)
Below is a snapshot of my Oracle VirtualBox machine. I would be connecting to the Fedora machine which is shown below.
To enable remote login to the Fedora server, we would have to enable port forwarding for the Linux box. To do this, click on the Setting button. This will open the virtual machine settings as shown in the below snapshot.
Click on the Network tab. This will open the networking properties for the Virtual machine. This is shown below.
Ensure that the “Enable Network Adapter” is clicked and it
is Attached to a “NAT” device. Click on the advanced tab to see the advanced
properties for the adapter.
On clicking the Advanced tab, you get a window as shown in the next snapshot.
Click on the port forwarding button to see the list of port
forwarding rules.
Define a rule for port forwarding as shown in
the next snapshot.
In the above snapshot, I have given the rule a name called
“ssh login”, the protocol is set to be TCP and I have given two port numbers.
Host port which is set at 3022 and guest port which is set at 22.
This basically means that any request on the host machine
(which is a Windows machine) that comes at port number 3022, must be redirected
to the guest machine (Fedora 23 server) at port number 22.
Port number 22 is used for SSH remote login protocol.
(This assumes that the virtual machine is up and running.
Else this will not work)
Although I power up my Linux box, I will not login to it. I
will use ssh to do the login.
The next snapshot shows me firing up my putty software to do
a SSH login to the Fedora server.
Observe that the hostname is set as “localhost” and the port
number is set at 3022 which is the host operating port number from the Port
Forwarding rule.
On clicking OK, it asks me for user name and
password which is shown in the next snapshot.
On
entering the credentials, I am able to login to the machine successfully which
is shown in the next snapshot.
This way you can do a remote login to a guest Linux machine
in Oracle virtual box.
(Note: - I have tried this on Fedora Workstation and Fedora Server
and it works successfully. I have also tried doing this on an Ubuntu flavor machine
and it works as expected. However, if you are using an Oracle Linux Server,
there is a small chance that the port forwarding might not work. I am still
trying to figure out where the issue is at…)
No comments:
Post a Comment