Ask Your Question

qemu user session shared filesystem

asked 2015-11-28 00:59:25 -0600

dimitrisk gravatar image

updated 2015-11-28 14:05:47 -0600

Hi there,

This is all with F23 host and guest(s):

I've been using a number of user session VMs for a while. I need to share files from my (non-root) host user's home directory with (also non-root, preferably) users in the guests. So far I've been using sshfs.

I'd like to switch to using virtio-9p as sshfs/SFTP does seem to be slowing things down. I (think I) have managed to get around the SELinux hurdle by setting the host shared directory's SELinux context to the virt_content_t type - I see no SELinux warnings when I read or (try to) write to the shared directory from the guest.

However, trying to write to the shared directory from the guest always results in a "permission denied" error.

I've tried all the combinations of the "security model" option, with no change in behavior. Any ideas will be much appreciated.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2015-11-28 15:04:21 -0600

dimitrisk gravatar image

Answering (tentatively) my own question here: I must have missed this SELinux context/access mode combo earlier.

The filesystem export is defined in the VM (added through virt-manager) as:

<filesystem type='mount' accessmode='squash'>
  <source dir='/home/d/wkto_share'/>
  <target dir='/wkto_share'/>
  <alias name='fs0'/>
  <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>

The host-side shared dir is labeled with:

drwxrwxr-x. 2 d d unconfined_u:object_r:svirt_home_t:s0 4096 Nov 28 12:47 wkto_share

It's in the guest's /etc/fstab as:

/wkto_share                               /home/d/wkto_share      9p      defaults,noauto

I now seem to have read/write access from both host and guest side.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2015-11-28 00:58:47 -0600

Seen: 226 times

Last updated: Nov 28 '15