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.
This commit is contained in:
Dave Gudge 2013-06-06 13:11:49 +02:00
parent 6d33fe440c
commit 699ac0ac96
1 changed files with 2 additions and 2 deletions

View File

@ -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