29

My Setup is as follows -

Host: Ubuntu Server 14.04 Guest: Lubuntu Desktop 15.10

I have shared dirs on host to guest with automount option, and the directories show up in Guest OS's just fine - /media/sf_sharename

Also, the user of guest is added to vboxsf group.

The problem is that all the shared dir and its contents are owned by root. I have tried chown -R, but it finishes without reporting error wihtin guest but the ownership does not change.

I have another setup where guest is ubuntu desktop 15.10, and I did not face this problem there.

I need rw access on those shared dirs. How to fix this?

1
  • What is the result of grep vboxsf /etc/group on the Guest system?
    – andrew.46
    Mar 23, 2016 at 5:21

4 Answers 4

29
+50

On Ubuntu Server host execute these commands :

sudo chmod -R 777 /path-to-shared-folder/shared-folder

sudo chown -R user1:user1 /path-to-shared-folder/shared-folder  

On Lubuntu Desktop guest execute this command :

sudo usermod -G vboxsf -a user2

Restart the guest system for changes taking effect.

Note : user1 = your host user name | user2 = your guest user name

7
  • 1
    To add a user to an existing group, you can also simply use sudo adduser USERNAME GROUPNAME instead of the described usermod command.
    – Byte Commander
    Mar 22, 2016 at 14:53
  • Does the $USER need to be a member of the group vboxsf on the Host system? My understanding was that this is only necessary on the Guest system...
    – andrew.46
    Mar 23, 2016 at 5:23
  • 1
    @andrew.46 : Thank you for your comment ! Of course you have to add the user to the vboxsf group in the guest ... I thought that this a known fact, but I updated the answer to make it more clear - Thanks again ! :)
    – cl-netbox
    Mar 23, 2016 at 9:01
  • @cl-netbox Thanks for your answer. I think changing the permission on the host fixed it. I already had the guest user in vboxsf group.
    – NRJ
    Mar 23, 2016 at 22:34
  • 4
    why should I make the files accessible to all users on the host system with 777 just to have access in the virtual box? It seems much more to me, that something should be changed with the mounting in the guest system
    – Jeno
    Nov 22, 2017 at 0:53
19

No need to change main group of user - add user into group is sufficient.

sudo adduser $USER vboxsf

After the command do a restart or logout and login.

4
  • 2
    not enough as mount -t can only be done by root and you need it for vboxsf
    – Titou
    Mar 6, 2017 at 14:53
  • 2
    Except that in some setups, mount -t is no longer needed, since the guest additions already do the mounting. In my case, this was all I had to do to get it working flawlessly, no need to change mount commands or folder permissions.
    – ApolloLV
    Mar 31, 2020 at 10:41
  • For me, a restart was needed after adduser, other than that the solution worked like a charm.
    – Cristik
    Aug 31, 2020 at 6:52
  • Why would adding my user to the vboxsf group do anything when the shared folder is owned by root? I did try it anyway and restarted, doesn't do anything.
    – Shardj
    Mar 20, 2023 at 16:52
13

It is not necessary to change the permissions on the host system, just easily mount the shared folder for the normal user:

sudo mount -t vboxsf folder share -o uid=1000,gid=1000

1000 is the default ID of the default user. This can be checked by id username

4
  • works for me, thanks, my host is Mac, client os is CentOS 6.3 Apr 9, 2018 at 6:33
  • worked perfectly for me
    – Bogatyr
    Aug 20, 2019 at 8:27
  • In Virtualbox 6.1 with Ubuntu running as a guest, mounting the share will only provide read-only access.
    – Zian Choy
    Nov 27, 2021 at 22:54
  • When I added the share into VirtualBox 6.1, I made sure "Read only" was unchecked. I'm able to write just fine.
    – Fauxcuss
    Nov 17, 2022 at 18:11
2

On Ubunut 18.04 (and I thin same for 14) two question, because with proposals solutions, is not fine on too many scenarios such nginx and others.

  1. Add user to group vboxsf
  2. Add mount in /etc/fstab
  3. Verify that user has 1000 for uid and gid using id $USER
sudo usermod -aG vboxsf $USER

/etc/fstab

shared_named_in_virtual_box /home/user/point_mount_name vboxsf defaults,dmode=755,fmode=644,gid=1000,uid=1000 0 0

After reboot, if you put correct values, you have a shared mount on /home/user/point_mount_name with correct values, for chmod dirs and files, and chowned by your user.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .