Skip to content
Snippets Groups Projects
Commit be1f9586 authored by Stefano Alberto Russo's avatar Stefano Alberto Russo
Browse files

Added X calc container and enabled X formwarding in the SSH container.

parent 2eebb901
No related branches found
No related tags found
No related merge requests found
...@@ -25,6 +25,9 @@ ChallengeResponseAuthentication no ...@@ -25,6 +25,9 @@ ChallengeResponseAuthentication no
UsePAM yes UsePAM yes
Subsystem sftp /usr/lib/ssh/sftp-server Subsystem sftp /usr/lib/ssh/sftp-server
PidFile ${HOME}/custom_ssh/sshd.pid PidFile ${HOME}/custom_ssh/sshd.pid
X11Forwarding yes
X11DisplayOffset 10
X11UseLocalhost no
EOF EOF
# Run # Run
......
FROM ssh
MAINTAINER Stefano Alberto Russo <stefano.russo@inaf.it>
# Switch to root
USER root
# Install Xclock
RUN apt-get install x11-apps -y
# Fix home permissions
RUN chmod 777 /home
# Set user (mainly for Singularity)
USER metauser
# Set container name
ENV CONTAINER_NAME='XCalc'
#!/bin/bash
docker build . -t xcalc
#/bin/bash
# Set port
if [ "x$BASE_PORT" == "x" ]; then
BASE_PORT=22
fi
# Set password
if [ "x$AUTH_PASS" != "x" ]; then
echo "[INFO] Setting linux password" # In the Dockerflie remove the -e
echo -e "metapass\n$AUTH_PASS\n$AUTH_PASS" | passwd
fi
# Prepare conf
mkdir ${HOME}/custom_ssh
ssh-keygen -f ${HOME}/custom_ssh/ssh_host_rsa_key -N '' -t rsa
ssh-keygen -f ${HOME}/custom_ssh/ssh_host_dsa_key -N '' -t dsa
cat << EOF > ${HOME}/custom_ssh/sshd_config
Port $BASE_PORT
HostKey ${HOME}/custom_ssh/ssh_host_rsa_key
HostKey ${HOME}/custom_ssh/ssh_host_dsa_key
AuthorizedKeysFile .ssh/authorized_keys
ChallengeResponseAuthentication no
UsePAM yes
Subsystem sftp /usr/lib/ssh/sftp-server
PidFile ${HOME}/custom_ssh/sshd.pid
EOF
# Run
echo "[INFO] Now running SSH server on port $BASE_PORT and listening."
/usr/sbin/sshd -D -f ${HOME}/custom_ssh/sshd_config
EXIT_CODE=$?
echo "Exit code: $EXIT_CODE"
if [[ "x$EXIT_CODE" != "x0" ]] && [[ "x$EXIT_CODE" != "x130" ]] ; then
echo "This exit code is an error, exiting."
exit $?
fi
echo ""
\ No newline at end of file
#!/bin/bash
docker run -v$PWD/:/data -p2222:2222 -eAUTH_PASS='testpass' -eBASE_PORT=2222 -it xcalc
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment