Previous page

Next page

Locate page in Contents

Print this page

Mounting Shared Folder as a Specific User

You can also configure the Shared Folders functionality in such a way that the owner of a shared folder and all its files will be the user who mounts the folder. To enable this option for a Linux virtual machine:

  1. Open the /etc/fstab file for editing.
  2. Locate the Shared Folders line:

    none /media/psf prl_fs sync,nosuid,nodev,noatime,share,context=system_u:object_r:removable_t:s0,nofail

  3. Remove the share option from this line so it looks like below:

    none /media/psf prl_fs sync,nosuid,nodev,noatime,context=system_u:object_r:removable_t:s0,nofail

  4. Save the file.

Once you complete the steps above, shared folders in a virtual machine will be seen by default as mounted and, therefore, owned by the root user, regardless of the user currently logged in to the virtual machine. For example:

[bob@dhcp-10-30-21-207]$ ls -l /media/psf/Shared

total 4

-rw-r--r--. 1 root root 143 May 4 19:04 1.txt

-rw-r--r--. 1 root root 0 May 4 19:04 2.txt

If necessary, you can change the owner and group of the /media/psf/Shared folder by mounting it with specific UID and GID options.