Skip to content

Commit

Permalink
fix: chdir to $SNAP before running command
Browse files Browse the repository at this point in the history
Allows to run the command because mongosh tries to cd to itself with the
snap_daemon user.
  • Loading branch information
Gu1nness committed Oct 2, 2024
1 parent ee5a8cf commit 9ab35e4
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions snap/local/drop_priv.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@
export PBM_MONGODB_URI="$(snapctl get pbm-uri)"

if [[ $(id -u) == "0" ]]; then

exec "${SNAP}"/usr/bin/setpriv \
exec bash -c "cd ${SNAP} && \
${SNAP}/usr/bin/setpriv \
--clear-groups \
--reuid snap_daemon \
--regid snap_daemon -- \
"$SNAP/usr/bin/$@"
--regid snap_daemon \
-- \
${SNAP}/usr/bin/$*"
else

exec "$SNAP/usr/bin/$@"
exec bash -c "cd ${SNAP} && \
${SNAP}/usr/bin/$*"
fi

0 comments on commit 9ab35e4

Please sign in to comment.