-
Notifications
You must be signed in to change notification settings - Fork 771
Expand file tree
/
Copy pathgenerate_container_user
More file actions
33 lines (27 loc) · 1.04 KB
/
generate_container_user
File metadata and controls
33 lines (27 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# Set current user in nss_wrapper
USER=${USER:-default}
USER_ID=$(id -u)
GROUP_ID=$(id -g)
echo "USER: $USER, USER_ID: $USER_ID, GROUP_ID: $GROUP_ID"
if [ x"$USER_ID" != x"0" ]; then
NSS_WRAPPER_PASSWD=/tmp/passwd
NSS_WRAPPER_GROUP=/etc/group
cat /etc/passwd > $NSS_WRAPPER_PASSWD
echo "${USER}:x:${USER_ID}:${GROUP_ID}:Default Application User:${HOME}:/bin/bash" >> $NSS_WRAPPER_PASSWD
export NSS_WRAPPER_PASSWD
export NSS_WRAPPER_GROUP
if [ -r /usr/lib/libnss_wrapper.so ]; then
LD_PRELOAD=/usr/lib/libnss_wrapper.so
elif [ -r /usr/lib64/libnss_wrapper.so ]; then
LD_PRELOAD=/usr/lib64/libnss_wrapper.so
elif [ -r /usr/lib/x86_64-linux-gnu/libnss_wrapper.so ]; then
LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libnss_wrapper.so
elif [ -r /usr/lib/aarch64-linux-gnu/libnss_wrapper.so ]; then
LD_PRELOAD=/usr/lib/aarch64-linux-gnu/libnss_wrapper.so
else
echo "no libnss_wrapper.so installed!"
exit 1
fi
echo "nss_wrapper location: $LD_PRELOAD"
export LD_PRELOAD
fi