diff options
author | Georg | 2021-08-14 20:38:16 +0200 |
---|---|---|
committer | Georg | 2021-08-14 20:38:16 +0200 |
commit | 39e54cc83b2d4d78191ada3dceafa22208336641 (patch) | |
tree | 5223463e800b43ff22b4b6c444c49cc2759724ea /lcpubsh/bin/user_mapping.sh | |
parent | c27753da863b3c44ceb81b2fe6ac689550704f89 (diff) | |
download | public-shell-39e54cc83b2d4d78191ada3dceafa22208336641.tar.gz public-shell-39e54cc83b2d4d78191ada3dceafa22208336641.tar.bz2 public-shell-39e54cc83b2d4d78191ada3dceafa22208336641.zip |
Signed-off-by: Georg <georg@lysergic.dev>
Diffstat (limited to 'lcpubsh/bin/user_mapping.sh')
-rw-r--r-- | lcpubsh/bin/user_mapping.sh | 18 |
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}" |