Skip to content

Commit 96619ed

Browse files
committed
If PUID or PGID is set, ensure the permissions on the SSH_AUTH_SOCK are correct (serversideup/spin#115)
1 parent 82c911f commit 96619ed

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/rootfs/entrypoint.sh

+5-2
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,13 @@ fi
8989

9090
# Run the command as the unprivileged user if PUID, PGID are set, or if RUN_AS_USER is different from default
9191
if [ ! -z "${PUID}" ] || [ ! -z "${PGID}" ] || [ "$run_as_user" != "$default_unprivileged_user" ]; then
92+
if [ "$SSH_AUTH_SOCK" ]; then
93+
debug_print "Ensure the SSH_AUTH_SOCK has the correct permissions..."
94+
chown "${PUID}:${PGID}" "$SSH_AUTH_SOCK"
95+
fi
9296
debug_print "Running command as \"$run_as_user\"..."
9397
switch_user "$@"
9498
else
9599
debug_print "Running command as root..."
96100
exec "$@"
97-
fi
98-
101+
fi

0 commit comments

Comments
 (0)