We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 441331d commit 9ac9a6fCopy full SHA for 9ac9a6f
1 file changed
run_as_user.sh
@@ -0,0 +1,13 @@
1
+#!/bin/sh
2
+
3
+# Exit on any error and treat unset variables as errors
4
+set -euo
5
6
+OLD_UID=$1
7
+OLD_GID=$2
8
+shift; shift
9
10
+groupadd --gid $OLD_GID --non-unique user
11
+useradd --uid $OLD_UID --gid $OLD_GID --non-unique user
12
13
+sudo -E -u user "$@"
0 commit comments