Skip to content

Commit

Permalink
Remove need for password for user chaste
Browse files Browse the repository at this point in the history
  • Loading branch information
bdevans committed Jan 9, 2025
1 parent 340edc5 commit df197de
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ ENV USER=${USER} \
GROUP=${USER} \
UID=${UID} \
GID=${UID} \
PASSWORD=${USER} \
# PASSWORD=${USER} \
CHASTE_DIR=${CHASTE_DIR} \
CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} \
Chaste_ERROR_ON_WARNING=${Chaste_ERROR_ON_WARNING} \
Expand All @@ -108,7 +108,9 @@ RUN userdel -r ubuntu || true
# RUN useradd -ms /bin/bash ${USER} && echo "${USER}:${PASSWORD}" | chpasswd && adduser ${USER} sudo
RUN groupadd -g ${GID} ${GROUP} && \
useradd -ms /bin/bash -u ${UID} -g ${GID} -d ${CHASTE_DIR} ${USER} -G users,sudo && \
echo "${USER}:${PASSWORD}" | chpasswd
# echo "${USER}:${PASSWORD}" | chpasswd
echo ${USER} ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/${USER} && \
chmod 0440 /etc/sudoers.d/${USER}

# Add scripts
COPY --chown=${USER}:${GROUP} scripts "${CHASTE_DIR}/scripts"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ If you want to use a package which is not installed within the image, you can in
```
sudo apt-get update && sudo apt-get install <PackageName>
```
Replacing `<PackageName>` as appropriate. Enter the password: `chaste` when prompted to do so.
Replacing `<PackageName>` as appropriate. The default user `chaste` has `sudo` privileges and is set to need no password.

Note that packages installed this way will not persist after the container is deleted (because the relevant files are not stored in `/home/chaste`). This can be avoided by omitting the `--rm` flag from the `docker run` command and using `docker start <container_name>` to relaunch a previously used container. If there is a package you think would be a particularly useful permanent addition to the Docker image, then email your suggestion to me or submit a pull request.

Expand Down

0 comments on commit df197de

Please sign in to comment.