Skip to content

Commit

Permalink
Remove need/use of password.txt (EleutherAI#795)
Browse files Browse the repository at this point in the history
Removes redundant generation/use/deletion of password.txt by placing the password as a variable and running echo with the variable directly.

Previously, the text 'password' was echoed into password.txt, then read from it again, before the file would finally get deleted.
  • Loading branch information
slycordinator authored Mar 3, 2023
1 parent 72c8071 commit 1f3894a
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,17 @@ RUN apt-get update -y && \

### SSH
# Set password
RUN echo 'password' >> password.txt && \
mkdir /var/run/sshd && \
echo "root:`cat password.txt`" | chpasswd && \
ENV PASSWORD=password
RUN mkdir /var/run/sshd && \
echo "root:${PASSWORD}" | chpasswd && \
# Allow root login with password
sed -i 's/PermitRootLogin without-password/PermitRootLogin yes/' /etc/ssh/sshd_config && \
# Prevent user being kicked off after login
sed -i 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' /etc/pam.d/sshd && \
echo 'AuthorizedKeysFile .ssh/authorized_keys' >> /etc/ssh/sshd_config && \
echo 'PasswordAuthentication yes' >> /etc/ssh/sshd_config && \
# FIX SUDO BUG: https://github.com/sudo-project/sudo/issues/42
echo "Set disable_coredump false" >> /etc/sudo.conf && \
# Clean up
rm password.txt
echo "Set disable_coredump false" >> /etc/sudo.conf

# Expose SSH port
EXPOSE 22
Expand Down

0 comments on commit 1f3894a

Please sign in to comment.