19

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?

  • What is the result of grep vboxsf /etc/group on the Guest system? – andrew.46 Mar 23 '16 at 5:21
19
+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

| improve this answer | |
  • 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 '16 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 '16 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 '16 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 '16 at 22:34
  • 2
    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 '17 at 0:53
10

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

sudo adduser myuser vboxsf
| improve this answer | |
  • 2
    not enough as mount -t can only be done by root and you need it for vboxsf – Titou Mar 6 '17 at 14:53
  • 1
    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 at 10:41
  • For me, a restart was needed after adduser, other than that the solution worked like a charm. – Cristik Aug 31 at 6:52
7

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

| improve this answer | |
  • works for me, thanks, my host is Mac, client os is CentOS 6.3 – Xiongmin LIN Apr 9 '18 at 6:33
  • worked perfectly for me – Bogatyr Aug 20 '19 at 8:27
  • Works for me, thanks! – ch271828n Sep 23 at 6:01
1

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.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.