VirtualBox shared folders are owned by root in Lubuntu guest
Solution 1
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
Solution 2
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.
Solution 3
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
Solution 4
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.
- Add user to group vboxsf
- Add mount in /etc/fstab
- 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.
Related videos on Youtube
NRJ
Updated on September 18, 2022Comments
-
NRJ over 1 year
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?
-
andrew.46 about 8 yearsWhat is the result of
grep vboxsf /etc/group
on the Guest system?
-
-
Byte Commander about 8 yearsTo add a user to an existing group, you can also simply use
sudo adduser USERNAME GROUPNAME
instead of the describedusermod
command. -
andrew.46 about 8 yearsDoes 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... -
Titou about 7 yearsnot enough as
mount -t
can only be done by root and you need it for vboxsf -
Jeno over 6 yearswhy 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
-
Xiongmin LIN about 6 yearsworks for me, thanks, my host is Mac, client os is CentOS 6.3
-
Bogatyr over 4 yearsworked perfectly for me
-
ApolloLV about 4 yearsExcept 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. -
Cristik over 3 yearsFor me, a restart was needed after
adduser
, other than that the solution worked like a charm. -
ch271828n over 3 yearsThe answer below
sudo mount -t vboxsf folder share -o uid=1000,gid=1000
works without changing permission of host -
Zian Choy over 2 yearsIn Virtualbox 6.1 with Ubuntu running as a guest, mounting the share will only provide read-only access.