Author : beriba | 02/01/2014

Using virtual machines is a very common practice. I’ll not tell you here the pros and cons of using them because it’s not the point of this post. One of the most popular VM tools is VirtualBox. While using linux VM you sometimes need to share some data between host and VM. Of course VirtualBox has a functionality to do that. From host (assuming that it is Windows) this folder is instantly accessible. But from VM this folder is only accessible by root. Adding sudo to every cp or any other command using shared folder isn’t what we really want. There is a solution. You just need to add your user to vboxsf group. You can do that by executing

sudo usermod -a -G vboxsf myusername

But that’s not everything. Now you just have to re-login (or reboot). But sometimes there are reasons to not reboot the VM. There’s also solution for that. You just have to do an explicit login.

su - myusername

There’s only one thing you have to remember. Until doing a re-login, you have to do an explicit login in every terminal session you open.