Skip to content

Instantly share code, notes, and snippets.

@peter279k
Forked from udkyo/Dockerfile
Created May 1, 2024 12:51
Show Gist options
  • Save peter279k/5f297b86e1aadd248c495f6b343f4599 to your computer and use it in GitHub Desktop.
Save peter279k/5f297b86e1aadd248c495f6b343f4599 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