# Create user 'user' and add them to 'sudo' access and set # the passwd to 'user'. FROM xe-base-stage AS xe-user-stage USER root RUN zypper install -y sudo # NOTE: Requires 'sudo' package to already be installed. ARG USERNAME=user ARG USER_UID=1000 ARG USER_GID=1000 RUN echo "Creating 'user': $USER_UID:$USER_GID" RUN groupadd -r ${USERNAME} \ && useradd --no-log-init \ -s /bin/bash \ -m \ -u ${USER_UID} \ -g ${USERNAME} \ -G users,video \ -p $(echo "${USERNAME}" | openssl passwd -stdin) ${USERNAME} # Change ALL ALL=(ALL) ALL to use '%users...NOPASSWD:ALL' RUN sed -i -e 's,^ALL.*,%users ALL=(ALL) NOPASSWD:ALL,g' /etc/sudoers USER user