Running Ubuntu as virtual machine via VirtualBox? You may encounter permission issue to access the shared folder between host and guest.
Shared Folders is an useful feature for file sync between Virtualbox host and guest OSes. However, after you created one, the shared folder is marked with cross and lock icons. And it pops up an error dialog when you trying to open it:
Unhandled error message:
GDBus.Error:org.freedesktop.PolicyKit1.Error.Failed: Unix process subject does not have uid set.
Or it prompts permission issue while accessing from the left pane in file manager:
You do not have permissions necessary to view the contents of “xxx”
Fix shared folder permission issue:
The shared folder belongs to vboxsf
group in the guest. All you need to do is add your user into this group.
There are a few ways to add an user to a group. Here I’m going to do it via a single command:
- Firstly, start the virtual machine and login.
- Open a terminal window from system app launcher.
- When terminal opens, run command to check your username in case you don’t remember:
whoami
- Finally add user to vboxsf group (replace USER_NAME with what printed in last command.):
sudo adduser USER_NAME vboxsf
Restart VM to apply change and enjoy!