mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
Fix monad-impersonate for OS X
Docker on OS X uses a Linux host for the containers, 99% of the time it's the boot2docker image. The user and group within the image (and their IDs) is different from that of the OS X user. However, the Linux host machine also has the OS X host /Users folder mounted (using a VirtualBox share). Given the permissions of the Linux user inside the container, the OS X user's folders are writable.
This commit is contained in:
+8
-1
@@ -40,8 +40,15 @@ monad-impersonate()
|
||||
local CUSER=$(id -un)
|
||||
local CGID=$(id -g)
|
||||
local CGROUP=$(id -gn)
|
||||
# default docker-machine VM does not change
|
||||
if [[ $OSTYPE == darwin* ]]; then
|
||||
CUID=1000
|
||||
CUSER=docker
|
||||
CGID=50
|
||||
CGROUP=staff
|
||||
fi
|
||||
echo \
|
||||
groupadd -g $CGID $CGROUP '&&' \
|
||||
groupadd -o -f -g $CGID $CGROUP '&&' \
|
||||
useradd -u $CUID -g $CGID -d /opt $CUSER '&&' \
|
||||
sudo --set-home -u $CUSER -g $CGROUP --
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user