Skip to content

Commit 07bdf06

Browse files
Read user name instead of hard-coding it
1 parent b5523f2 commit 07bdf06

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/common/scripts/generate_container_user

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# Set current user in nss_wrapper
2+
USER=$(id -un)
23
USER_ID=$(id -u)
34
GROUP_ID=$(id -g)
4-
echo "USER_ID: $USER_ID, GROUP_ID: $GROUP_ID"
5+
echo "USER: $USER, USER_ID: $USER_ID, GROUP_ID: $GROUP_ID"
56

67
if [ x"$USER_ID" != x"0" ]; then
78

@@ -10,7 +11,7 @@ if [ x"$USER_ID" != x"0" ]; then
1011

1112
cat /etc/passwd > $NSS_WRAPPER_PASSWD
1213

13-
echo "default:x:${USER_ID}:${GROUP_ID}:Default Application User:${HOME}:/bin/bash" >> $NSS_WRAPPER_PASSWD
14+
echo "${USER}:x:${USER_ID}:${GROUP_ID}:Default Application User:${HOME}:/bin/bash" >> $NSS_WRAPPER_PASSWD
1415

1516
export NSS_WRAPPER_PASSWD
1617
export NSS_WRAPPER_GROUP

0 commit comments

Comments
 (0)