Tagged: virtualbox

Sharing Host’s directories in Guests


~/.m2

Windows

Run Windows Command Processor as administrator

\ cd C:\Users\<you>
\ mklink /D C:\Users\<you>\.m2 \\VBOXSVR\<shared>\.m2

Ubuntu

$ pwd
/home/<you>
$ ln -s /media/<shared>/.m2

~/.ssh

Ubuntu

$ pwd
$ /home/<you>
$ ln -s /media/<shared>/.ssh
$ cat /etc/ssh/sshd_config
...
#StrictModes yes
StrictModes no
...
$

Installing VirtualBox Guest Additions in Ubuntu Server


Insert the image by selecting the menu item of Devices / Insert Guest Additions CD Image... (Host+D).

Mount the inserted image.

$ sudo mount -t iso9660 -o ro /dev/cdrom /media/cdrom

Execute VBoxLinuxAdditions.run file.

$ cd /media/cdrom
$ ls -1F
...
VBoxLinuxAdditions.run
...
$ sudo ./VBoxLinuxAdditions.run
...
$

The script may complain about the absence of gcc and make. Install them and run the script again.

$ sudo apt-get -y install gcc make
...
$ sudo ./VBoxLinuxAdditions.sh
...
$

You can unmount the cdrom.

$ sudo umount /media/cdrom
$

You might want to reboot the guest.

$ sudo /sbin/shutdown -r now
$

One of benefits that guest additions offers is sharing folders between the host and the guest.

$ ls -l /media
drwxr-xr-x 2 root root    ____ MMM dd HH:mm cdrom/
drwxrwx--- 1 root vboxsf _____ MMM dd HH:mm sf_shared/
$

You can add yourself to vboxsf group and use them.

$ sudo adduser <yourself> vboxsf
...

You need to logout and login for making the change effects.

$ logout
$

Now you can read/(write) in the shared directory.

$ cd /media/sf_shared/
$ echo test > test.txt
$ cat test.txt
test
$