Skip to content

Commit

Permalink
add lost file
Browse files Browse the repository at this point in the history
  • Loading branch information
segoon committed Feb 11, 2025
1 parent 2922c36 commit 60bd394
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions run_as_user.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/sh

# Exit on any error and treat unset variables as errors
set -euo

OLD_UID=$1
OLD_GID=$2
shift; shift

groupadd --gid $OLD_GID --non-unique user
useradd --uid $OLD_UID --gid $OLD_GID --non-unique user

sudo -E -u user "$@"

0 comments on commit 60bd394

Please sign in to comment.