Skip to content

Instantly share code, notes, and snippets.

@Epsilon8854
Forked from udkyo/Dockerfile
Created April 19, 2022 15:35
Show Gist options
  • Select an option

  • Save Epsilon8854/f14c273cf9dcb99652baa3271aded7b7 to your computer and use it in GitHub Desktop.

Select an option

Save Epsilon8854/f14c273cf9dcb99652baa3271aded7b7 to your computer and use it in GitHub Desktop.
Basic container for X11 forwarding goodness
FROM ubuntu
RUN apt update \
&& apt install -y firefox \
openssh-server \
xauth \
&& mkdir /var/run/sshd \
&& mkdir /root/.ssh \
&& chmod 700 /root/.ssh \
&& ssh-keygen -A \
&& sed -i "s/^.*PasswordAuthentication.*$/PasswordAuthentication no/" /etc/ssh/sshd_config \
&& sed -i "s/^.*X11Forwarding.*$/X11Forwarding yes/" /etc/ssh/sshd_config \
&& sed -i "s/^.*X11UseLocalhost.*$/X11UseLocalhost no/" /etc/ssh/sshd_config \
&& grep "^X11UseLocalhost" /etc/ssh/sshd_config || echo "X11UseLocalhost no" >> /etc/ssh/sshd_
config
RUN echo "YOUR_PUB_KEY_HERE" >> /root/.ssh/authorized_keys
ENTRYPOINT ["sh", "-c", "/usr/sbin/sshd && tail -f /dev/null"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment