Fix VirtualBox Shared Folder Is Locked / Unable to Open in Ubuntu 21.04

Last updated: May 14, 2021

Virtualbox

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:

  1. Firstly, start the virtual machine and login.
  2. Open a terminal window from system app launcher.
  3. When terminal opens, run command to check your username in case you don’t remember:
    whoami
  4. 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!

Twitter

I'm a freelance blogger who started using Ubuntu in 2007 and wishes to share my experiences and some useful tips with Ubuntu beginners and lovers. Please comment to let me know if the tutorial is outdated! And, notify me if you find any typo/grammar/language mistakes. English is not my native language. Contact me via [email protected] Buy me a coffee: https://ko-fi.com/ubuntuhandbook1 |