Shared Folders Don't Appear on Virtual Machines Running Red Hat Linux and SELinux
search cancel

Shared Folders Don't Appear on Virtual Machines Running Red Hat Linux and SELinux

book

Article ID: 342271

calendar_today

Updated On:

Products

VMware Desktop Hypervisor

Issue/Introduction

After rebooting a Red Hat Linux guest that runs SELinux, shared folders no longer appear under the /mnt/hgfs folder. The virtual machine's preferences, however, show the folder as being shared.


Environment

VMware Workstation Player 12.x (Windows)
VMware Workstation 7.x (Windows)
VMware Fusion 8.x
VMware Player Pro 7.x (Linux)
VMware Workstation 10.x (Windows)
VMware Workstation Pro 14.x (for Windows)
VMware Fusion 2.x
VMware Player 5.x (Windows)
VMware Workstation 9.x (Linux)
VMware Player 7.x (Windows)
VMware Fusion 3.x
VMware Player 4.x (Windows)
VMware Workstation Player 14.x (Linux)
VMware Workstation Pro 14.x (for Linux)
VMware Fusion 5.x
VMware Workstation Pro 12.x (Linux)
VMware Workstation 5.x (Linux)
VMware Fusion 6.x
VMware Fusion 10.x
VMware Workstation 6.x (Windows)
VMware Workstation 6.x (Linux)
VMware Fusion Pro 10.x
VMware Workstation 11.x (for Linux)
VMware Workstation 8.x (Linux)
VMware Player 5.x (Linux)
VMware Workstation 11.x (for Windows)
VMware Fusion 4.x
VMware Workstation 9.x (Windows)
VMware Player 7.x (Linux)
VMware Workstation Player 12.x (Linux)
VMware Workstation Player 14.x (Windows)
VMware Fusion Pro 8.x
VMware Player 6.x (Windows)
VMware Player 4.x (Linux)
VMware Workstation 7.x (Linux)
VMware Player 3.x (Linux)
VMware Workstation 8.x (Windows)
VMware Fusion 7.x
VMware Player 3.x (Windows )
VMware Player Pro 7.x (Windows)
VMware Workstation 5.x (Windows)
VMware Workstation 10.x (Linux)
VMware Workstation Pro 12.x (Windows)
VMware Player 6.x (Linux)

Resolution

There are three solutions you can use to work around this problem.

Note: VMware does not disable SELinux.

Solution 1: Restart vmware-tools

Open a terminal window and run the following command as root to restart vmware-tools. You need to do this after you boot the virtual machine, each time.

[root@linux_vm]# /etc/init.d/vmware-tools restart

At boot, VMware's vmware-guestd process runs within the Red Hat/SELinux security context initrc_t. When the process runs in this context, it does not have the necessary privileges to mount(2) /mnt/hgfs and, therefore, your shared folders do not show up. When you restart the VMware services after boot, they run within the default unconfined_t context for non-targeted processes within Red Hat's default "targeted" SELinux policy. Running under this context provides the needed privileges to mount(2) the hgfs shared folders.

Solution 2: Disable SELinux (not recommended)

Disable SELinux by supplying the selinux=0 parameter to the kernel in the grub.conf file by running this command:

kernel /vmlinuz-2.6.xxx_FC4 ro selinux=0

Caution: Restarting VMware's services simply restarts the vmware-guestd process, which allows it to successfully complete the mount(2) as described above. Setting selinux=0 in your grub.conf file disables SELinux entirely and removes the security checks that cause the boot-time mount(2) from failing. This second solution also disables all SELinux-associated security checks and should only be used if you are certain that you do not need them in your virtual machine.

Solution 3: Modify vmware-tools (advanced users)

Another option is to modify the /etc/init.d/vmware-tools file to run vmware-guestd within a specific context using the /usr/bin/runcon command. You can do this with something similar to the following in the vmware_start_guestd() function of the init.d file:

/usr/bin/runcon -t unconfined_t -- /path/to/vmware-guestd \
--background /path/to/vmware-guestd.pid

Note: You need to replace the paths with the variables that show up in that file. The command is shown split across 2 lines with a newline escape character (\).

Warning: This solution might cause warning messages or failure to remove the vmware-tools file when uninstalling or upgrading VMware Tools because the file has been modified. Make sure you keep a copy of the original vmware-tools file before editing it.

Additional Information

For translated versions of this article, see: