Mounting a host folder in WSL or VirtualBox Kali machine

Oct 6, 2022 by Frederic Hallot | 339 views

WSL Kali CSC

https://cylab.be/blog/238/mounting-a-host-folder-in-wsl-or-virtualbox-kali-machine

Most people using kali won't use it on a dedicated machine. For Windows users most would use kali from WSL (Windows Subsystem for Linux). Other would use a virtual machine in VirtualBox or other virtualization environment. In this post we will only cover VirtualBox. In this case it can be useful to have a folder on the host machine that can be shared in the kali environment.

WSL

In WSL the solution is quite straightforward, every host hard drives are visible in the /mnt folder so a symbolic link would suffice to give direct access for example to an assets folder from the home folder

sudo ln -s /mnt/<hd letter>/<path/to/your/folder>/ /home/kali/assets

VirtualBox

In Virtual box two steps are needed to get the same result

1. Sharing the folder in VirtualBox

First you have to share the folder from your host machine in the virtual machine configuration

vboxshare.jpg

vboxshare2.jpg

2. Adding the user to the vbox group (if necessary)

After step 1 your folder is visible in the /home/kali/assets folder and belongs the vboxsf group

vboxshare3.jpg

In older version of the kali VM distributions, the kali users was not added to the vboxsf group, and when you try to connect to the /home/kali/assets directory, you receive a security error message

vboxshare4.jpg

If this is the case you can solve the problem by executing:

sudo adduser $USER vboxsf

and then you have to logout and login again

vboxshare5.jpg

After next, suddenly your folder shared from your host machine will be available definitively in your home directory!

vboxshare6.jpg

Hope this helps

This website uses cookies. More information about the use of cookies is available in the cookies policy.
Accept