Last active
April 17, 2022 04:33
-
-
Save saku/887407eda437a04acf295f9953e8c854 to your computer and use it in GitHub Desktop.
Ubuntu with default user who can use sudo unless password.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM ubuntu | |
ARG USERNAME=user | |
ARG USERPASS=user | |
ARG GROUPNAME=user | |
ARG UID=1000 | |
ARG GID=1000 | |
RUN apt -y update && apt install -y sudo | |
RUN groupadd -g $GID $GROUPNAME && \ | |
useradd -m -s /bin/bash -p $USERPASS -u $UID -g $GID $USERNAME && \ | |
gpasswd -a $USERNAME sudo && \ | |
echo "$USERNAME:$USERPASS" | chpasswd && \ | |
echo "user ALL=NOPASSWD: ALL" >> /etc/sudoers | |
USER $USERNAME | |
WORKDIR /home/$USERNAME/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment