Linux System Administration

You have just installed and running some Linux distribution within the VirtualBox guest machine. At the same time, you have discovered that you are unable to create a ssh ( Secure Shell ) connection from your host operating system to your new VirtualBox guest machine. The default behavior of the VirtualBox does not allow that connection to happen.

There are two ( possibly more ) solutions to this problem. First solution is to create a bridged network interface and link your virtual guest by changing a guest's network interface settings. This may not be as easy as it sounds, but generally it works well and setup is easy. The second solution involves a port forwarding of a port 22 to your virtual guest machine. This solution is very easy to implement, but it does not work with older VirtualBox versions.

This article will guide you to implement the easier port forwarding solution. First check if your VirtualBox version supports a NAT port forwarding by executing a following command:

Check for VirtualBox NAT forward availability

$ VBoxManage modifyvm | grep natpf

If you do not observe any output you would need to upgrade your VirtualBox software. Next, open up a terminal on a host operating system.

create SSH port forward

Find a name of your virtual guest machine: NOTE: The following command needs to be run by a user who has an ownership of the above virtual machine as this command will display only virtual machines which a current user owns. In most cases this is NOT a root user.

$ VBoxManage list vms

Execution of a following command on the host operating system we redirect any traffic coming on port 2222 to a port 22 listening on a guest virtual machine with a name "Ubuntu_10.04".

$ VBoxManage modifyvm "Ubuntu_10.04" --natpf1 "host2guest-ssh,tcp,,2222,,22"

Login to guest SSH using port forward

All done. Now start your guest virtual machine and ssh to with a following command:

$ ssh -p 2222 username@localhost

If your guest operating system is using a static IP address you can modify the above port forward command to specify a guest IP address.:

$ VBoxManage modifyvm "Ubuntu_10.04" --natpf1 "host2guest-ssh,tcp,,2222,,22"


If you are still unable to ssh to your guest virtual machine check the following:

  • check whether your host operating system is listening on port 2222

$ netstat -ant | grep 2222

  • check if sshd is installed and running on your guest operating system.

Many UNIX application are using an EPOCH time to determine a date, on most Linux systems an EPOCH time started on 1.1.1970 and will end on 18.1.2038 as defined by a time_t UNIX C library. Epoch time digit contains a number of seconds since the start of epoch ( 1.1.1970 and 10 hours ).

To get a better understanding consider an example where epoch number is "1". Now convert this epoch time to a real time/ When using bash we can execute a following command:

~$ date --date "Jan 1, 1970 00:00:00 +0000 + 1 seconds"
Thu Jan  1 10:00:01 EST 1970

To get a current epoch time we simply use date command as follows:

~$ date +%s

As already mentioned above, to convert a epoch time digit to real time we can use for example by

~$ date --date "Jan 1, 1970 00:00:00 +0000 + 1284763671 seconds"
Sat Sep 18 08:47:51 EST 2010


date -d@1284763671
Sat Sep 18 08:47:51 EST 2010


~$ perl -e 'print scalar(localtime(1284763671)), "\n"'
Sat Sep 18 08:47:51 2010


To convert to Coordinated Universal Time using bash type:

~$ date -ud@1284763671
Fri Sep 17 22:47:51 UTC 2010

Rar archive utility is not avaiable on Fedora linux by default. If you are i need to extract / unrar rar archive files you can use official rarlab command line tool.

First download rar utility package for linux from .

Extract gzip tarball:

tar xvzf rarlinux-4.0.b6.tar.gz

move rar directory into /opt/

# mv rar /opt/

Next, we need to include rar and unrar executables into our bash shell path so we do not have to enter full path every time we want to execute it. Use your favorite text editor and add / alter a following line into your ~/.bash_profile:


Now you need to logout and login again and you should be able to extract any rar archive file with unrar executable:

$ unrar x rar-file.rar

Page 66 of 72

Free Linux eBooks

Go to top