summaryrefslogtreecommitdiffstats
path: root/lcpubsh/bin/user_mapping.sh
diff options
context:
space:
mode:
Diffstat (limited to 'lcpubsh/bin/user_mapping.sh')
-rw-r--r--lcpubsh/bin/user_mapping.sh18
1 files changed, 18 insertions, 0 deletions
diff --git a/lcpubsh/bin/user_mapping.sh b/lcpubsh/bin/user_mapping.sh
new file mode 100644
index 0000000..9b32ba0
--- /dev/null
+++ b/lcpubsh/bin/user_mapping.sh
@@ -0,0 +1,18 @@
+#!/bin/bash
+# Original by https://github.com/sleeepyjack/dockersh
+# Modified by georg@lysergic.dev
+
+if [ -z "${HOST_USER_NAME}" -o -z "${HOST_USER_ID}" -o -z "${HOST_USER_GID}" ]; then
+ echo "HOST_USER_NAME, HOST_USER_ID & HOST_USER_GID needs to be set!"; exit 100
+fi
+useradd \
+ --uid ${HOST_USER_ID} \
+ -U \
+ -m \
+ -s /bin/bash \
+ ${HOST_USER_NAME}
+sleep 3s
+
+echo ${HOST_USER_NAME}:${HOST_USER_NAME} | chpasswd
+
+exec su - "${HOST_USER_NAME}"