-
-
Save udkyo/c20935c7577c71d634f0090ef6fa8393 to your computer and use it in GitHub Desktop.
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"] |
Do you have the password.txt
file? It seems that you don't have the password.txt
file and this file and Dockerfile
are same file path.
And the sample password.txt
file contents are as follows:
your-password
Oh I have managed to get past the password part, appears I didn't add the UNIX newline character, thank you so much for you help!
Very helpful stuff here but the the content has traveled some since the initial post. Steps I used:
- @AutomationMusician's April 2018 post with the password file trick
- @peter279k's suggestion to use
FROM ubuntu:18.04
(edit: just tried again with 22.04 and it was fine) and his other steps on July 16, 2021. If you ssh in without filrefox on the end you can just type it at the terminal
Note that if you're working in a text editor that automatically adds a newline, like vim, don't add a blank line as it will do that for you (and the blank line will break it).
Might come back for the ssh keys-based method later.
I'm on MacOS and it's interesting to me that nowhere was the DISPLAY environment variable mentioned, or volume informations specified (e.g., '-v /tmp/.X11-unix:/tmp/.X11-unix'). These were huge red herrings in my attempts to figure this out.
Thanks. It also works for foreign architecture.
@peter279k I tried using that dockerfile instead and building by your instructions, it returns the following error
I think I did follow it step by step without any other manipulations. I am rather new to this so very sorry if I am making some stupid mistake.
@AutomationMusician I do have X11 forwarding via PuTTY, ran xclock on the remote server and could get the display on my local machine.