Skip to content
This repository has been archived by the owner on Jun 5, 2024. It is now read-only.

Commit

Permalink
Fix user password error on boot (#111)
Browse files Browse the repository at this point in the history
  • Loading branch information
wanjohiryan committed Oct 26, 2023
1 parent d687e7a commit 77acdcd
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
14 changes: 5 additions & 9 deletions docker/base/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ ENV LC_ALL en_US.UTF-8
ENV TZ UTC

ARG USERNAME=admin
ARG USER_UID=1000
ARG USER_GID=${USER_UID}
ENV PASSWD=admin

#
# Add dependencies
Expand Down Expand Up @@ -110,9 +109,8 @@ RUN apt-get update; \
#
#create a non-root user
#
groupadd --gid ${USER_GID} ${USERNAME}; \
useradd --uid ${USER_UID} --gid ${USERNAME} --shell /bin/bash --create-home ${USERNAME};\
usermod -a -G adm,audio,input,pulse-access,sudo,tape,tty,video,ffmpeg ${USERNAME} ;\
useradd --create-home --shell /bin/bash ${USERNAME};\
usermod -a -G adm,audio,input,pulse-access,sudo,tape,tty,video,ffmpeg ${USERNAME};\
#
#Remove sudo password
echo "${USERNAME} ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers; \
Expand All @@ -121,9 +119,7 @@ RUN apt-get update; \
#
mkdir -p /certs /scripts /media;\
chmod 1777 /certs /scripts /media; \
chown ${USERNAME} /certs /media /scripts; \
chown -R $USERNAME:$USERNAME /home/${USERNAME} ;\
ln -snf "/usr/share/zoneinfo/$TZ" /etc/localtime && echo "$TZ" > /etc/timezone
chown ${USERNAME} /certs /media /scripts

#
# Disable systemd services/units that are unnecessary within a container.
Expand All @@ -145,7 +141,7 @@ RUN apt-get update -y && apt-get install -y curl; \
# Add user "admin" to the Docker group
#
groupadd docker; \
usermod -a -G docker $USERNAME; \
usermod -a -G docker ${USERNAME}; \
newgrp docker

ADD https://raw.githubusercontent.com/docker/docker-ce/master/components/cli/contrib/completion/bash/docker /etc/bash_completion.d/docker.sh
Expand Down
9 changes: 8 additions & 1 deletion docker/base/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
#!/bin/bash

#Create directories for selkies-js-interposer
# Make user directory owned by the user in case it is not
chown -R $USER:$USER /home/$USER

# Change operating system password to environment variable
echo "$USER:$PASSWD" | sudo chpasswd

# Change time zone from environment variable
sudo ln -snf "/usr/share/zoneinfo/$TZ" /etc/localtime && echo "$TZ" | sudo tee /etc/timezone > /dev/null

export DISPLAY="${DISPLAY:-:0}"

Expand Down

0 comments on commit 77acdcd

Please sign in to comment.