From 699ac0ac96e2906f0f96c3088d9dff250b9b9896 Mon Sep 17 00:00:00 2001 From: Dave Gudge Date: Thu, 6 Jun 2013 13:11:49 +0200 Subject: [PATCH] Defining the group of a shared folder Symtom: The group ID for groups that are not backed by a user account (e.g. admin) cannot be obtained from the id command. Consequence: The shared folder group can only be set to a group where by a user account of the same name exists. Solution: Correcting the method to define the group ID by looking up the group ID via the group name. --- plugins/guests/linux/cap/mount_virtualbox_shared_folder.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/guests/linux/cap/mount_virtualbox_shared_folder.rb b/plugins/guests/linux/cap/mount_virtualbox_shared_folder.rb index 2b3fa026d..0c04d5f6b 100644 --- a/plugins/guests/linux/cap/mount_virtualbox_shared_folder.rb +++ b/plugins/guests/linux/cap/mount_virtualbox_shared_folder.rb @@ -7,7 +7,7 @@ module VagrantPlugins :shell_expand_guest_path, guestpath) # Determine the permission string to attach to the mount command - mount_options = "-o uid=`id -u #{options[:owner]}`,gid=`id -g #{options[:group]}`" + mount_options = "-o uid=`id -u #{options[:owner]}`,gid=`getent group #{options[:group]} | cut -d: -f3`" mount_options += ",#{options[:extra]}" if options[:extra] mount_command = "mount -t vboxsf #{mount_options} #{name} #{expanded_guest_path}" @@ -32,7 +32,7 @@ module VagrantPlugins # Chown the directory to the proper user machine.communicate.sudo( - "chown `id -u #{options[:owner]}`:`id -g #{options[:group]}` #{expanded_guest_path}") + "chown `id -u #{options[:owner]}`:`getent group #{options[:group]} | cut -d: -f3` #{expanded_guest_path}") end end end