BVLog Bryan Voss’ mental synchronization point


Fixing VMWare Server directory permissions on Debian hosts

I often create a VMWare virtual machine using VMWare Workstation on my laptop, then later move it to a Debian machine running VMWare Server. As a result of the move from Windows to Linux, permissions on the VM directory end up being wrong and I get a blank black screen when connecting the VMWare Server Console to the VM. I normally just fix the permissions manually when I notice the problem.

Today, I was helping my father deal with the same situation via email and started typing out all the steps to create a group and fix permissions on the VM directory when I thought, "Why not be a good little sysadmin and write a script to do this?" So, here's the resulting BASH script:

# Fix VMWare Server permissions on Debian host
# Bryan Voss 2007/07/19

# *** Config items ***
# Group that all VMWare users will belong to
# *** /Config items ***

# Find directory where VMs are stored
VMDIR=`grep vmdir /etc/vmware/config | cut --delimiter=' ' -f 3 | cut --delimiter='"' -f 2`

# Add group that VMs should belong to
addgroup --system $VMGROUP

# Fix permissions on directories under VMDIR
chgrp -R $VMGROUP *
find . -type d -exec chmod g+rwxs \{\} \;

# Fix permissions on vmx files
find . -name *.vmx -exec chmod -R +x,g+rwx \{\} \;
# Fix permissions on all other files
chmod -R g+rw *

Make sure any users who will be connecting via VMWare Server Console are members of whatever group you set VMGROUP to ("vmware" by default).

I have saved this as /usr/local/sbin/vmware-fixperms on my VMWare Server boxes and will probably use it pretty often. Maybe others will benefit from it.

Comments (0) Trackbacks (0)

No comments yet.

Leave a comment

No trackbacks yet.