Previous page

Next page

Locate page in Contents

Print this page

Sharing with Ownership of a Virtual Machine User

By default, Shared Folders are set to work in such a way that any user currently logged in to a virtual machine is considered as the owner of a shared folder and all files in it. To check that this mode of operation is enabled for a virtual machine, log in to it and examine the /etc/fstab file. If this mode is on, the following lines should be present in /etc/fstab :

# Parallels Shared Folder mount

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

In general, to share a folder on the physical server with a virtual machine, you need to do the following:

  1. Make sure that the virtual machine has Parallels Tools installed.
  2. Enable the Shared Folders functionality for the virtual machine.
  3. Specify what folder to share and under which name to mount it in the virtual machine.

Once you complete these steps, the shared folder should appear as a subdirectory in /media/psf in the virtual machine and can be accessed by users of this virtual machine.

For example, to share the /home/SharedFolder directory located on the server and storing two files ( 1.txt and 2.txt ) and mount it to the /media/psf/Shared directory in the MyVM virtual machine, you can run these commands:

# prlctl set MyVM --shf-host on

# prlctl set MyVM --shf-host-add Shared --path /home/SharedFolder

After that, the Shared folder should appear in the /media/psf directory in the MyVM virtual machine and contain the same two files as the /home/SharedFolder directory on the server:

# ls -l /home/SharedFolder

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

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

total 4

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

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

As you can see, the files are exactly the same but owned by different users. While the owner of the files on the server is root , the owner of the same files in the MyVM virtual machine is bob , the user currently logged in to this virtual machine.

If you now log off of the MyVM virtual machine and log in to it again as the jack user, the owner of 1.txt and 2.txt will be changed to jack :

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

total 4

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

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

As for permissions for the /media/psf/Shared directory and its files, they may or may not coincide with those of these files on the physical server.

To unmount the Shared folder from the MyVM virtual machine, use this command:

# prlctl set MyVM --shf-host-del Shared