Skip to content
Snippets Groups Projects
Commit fcac5993 authored by Jan David Mol's avatar Jan David Mol
Browse files

Task #10302: Update to latest chuser mechanism, avoiding use of sudo

parent 18c05c3f
Branches
Tags
No related merge requests found
......@@ -2375,6 +2375,7 @@ Docker/lofar-outputproc/Dockerfile.tmpl -text
Docker/lofar-pipeline/Dockerfile.tmpl -text
Docker/lofar-pulp/Dockerfile.tmpl -text
Docker/lofar-pulp/bashrc -text
Docker/lofar-pulp/chuser.sh -text
Docker/lofar-pulp/sudoers -text
Docker/lofar-tbbwriter/Dockerfile -text
Docker/lofar-tbbwriter/bashrc -text
......
......@@ -61,3 +61,5 @@ RUN apt-get update && apt-get install -y liblog4cplus-dev libhdf5-dev libblitz0-
apt-get autoremove -y
COPY ["bashrc", "/opt/"]
COPY ["chuser.sh", "/usr/local/bin"]
ENTRYPOINT ["/usr/local/bin/chuser.sh"]
#!/usr/bin/env bash
# Configure user
if [ -z "${USER}" ]; then
export USER=${UID}
fi
# Create home directory
if [ -z "${HOME}" ]; then
export HOME=/home/${USER}
mkdir -p $HOME && cd $HOME
fi
# Add user to system
fgrep -q ":x:${UID}:" /etc/passwd || echo "${USER}:x:${UID}:${UID}::${HOME}:/bin/bash" >> /etc/passwd
fgrep -q ":x:${UID}:" /etc/group || echo "${USER}:x:${UID}:" >> /etc/group
# Set the environment
[ -e /opt/bashrc ] && source /opt/bashrc
# Run the requested command
if [ -z "$*" ]; then
exec /bin/bash
else
exec "$@"
fi
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment