Skip to content

Instantly share code, notes, and snippets.

@webflo-dev
Created August 4, 2020 14:51
Show Gist options
  • Save webflo-dev/9d099339a6f10f506d6da270178eb963 to your computer and use it in GitHub Desktop.
Save webflo-dev/9d099339a6f10f506d6da270178eb963 to your computer and use it in GitHub Desktop.
ubuntu image with non-root user
FROM ubuntu:latest
RUN apt -y update && \
apt -y full-upgrade && \
apt -y autoremove && \
apt -y install sudo zsh git curl
RUN useradd -U -m john && \
usermod -aG sudo -s /bin/zsh john && \
echo "john ALL=(root) NOPASSWD:ALL" > /etc/sudoers.d/john && \
chmod 0440 /etc/sudoers.d/john && \
echo "Set disable_coredump false" >> /etc/sudo.conf && \
touch /home/john/.zshrc && \
chown john:john /home/john/.zshrc
USER john
WORKDIR /home/john
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment