diff --git a/entrypoint.sh b/entrypoint.sh index d063a3c1..dc6e1ba8 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,4 +1,8 @@ #!/usr/bin/env bash +if [ ! -z "$EXPOSE_SSH" ]; then + /usr/sbin/sshd -e +fi + # run command exec "$@" diff --git a/targets/python37-jupyter-pytorch-tensorflow-jupyterlab/Dockerfile b/targets/python37-jupyter-pytorch-tensorflow-jupyterlab/Dockerfile index 9e2ed54c..48ec85aa 100644 --- a/targets/python37-jupyter-pytorch-tensorflow-jupyterlab/Dockerfile +++ b/targets/python37-jupyter-pytorch-tensorflow-jupyterlab/Dockerfile @@ -185,6 +185,35 @@ RUN mkdir -p /var/notebooks COPY files/var/notebooks/README.ipynb /var/notebooks +# ================================================================== +# Set up SSH for remote debug +# ------------------------------------------------------------------ + +# Setup environment for ssh session +RUN apt-get install -y --no-install-recommends openssh-server && \ + echo "export PATH=$PATH" >> /etc/profile && \ + echo "export LANG=$LANG" >> /etc/profile && \ + echo "export LANGUAGE=$LANGUAGE" >> /etc/profile && \ + echo "export LC_ALL=$LC_ALL" >> /etc/profile && \ + echo "export PYTHONIOENCODING=$PYTHONIOENCODING" >> /etc/profile + +# Create folder for openssh fifos +RUN mkdir -p /var/run/sshd + +# Disable password for root +RUN sed -i -re 's/^root:[^:]+:/root::/' /etc/shadow +RUN sed -i -re 's/^root:.*$/root::0:0:System Administrator:\/root:\/bin\/bash/' /etc/passwd + +# Permit root login over ssh +RUN echo "Subsystem sftp /usr/lib/sftp-server \n\ +PasswordAuthentication yes\n\ +ChallengeResponseAuthentication yes\n\ +PermitRootLogin yes \n\ +PermitEmptyPasswords yes\n" > /etc/ssh/sshd_config + +# ssh port +EXPOSE 22 + # ================================================================== # config & cleanup # ------------------------------------------------------------------