I installed today Ubuntu Server Edition 7.04 on one of my machines and here practically nothing is installed. Therefore for example X11 forwarding doesn’t work if you remotely log in with “ssh -X” (after you installed openssh-server :). So, if you start a X11 program you get e.g.:
xterm Xt error: Can’t open display:
xterm: DISPLAY is not set
I found the solution here. You need to install the program xauth with
sudo apt-get install xauth
and off you go.
18 thoughts on “X11 forwarding with OpenSSH on bare Ubuntu Server Edition”
This is the only place on the internet listing this. IN FACT, I read several tutorials that said you did not need to have xauth installed if you were using a putty/ssh based X11 “tunnel”
Actually these blog entries are not meant to be tutorials of any kind. I just write about solutions I found for problems I had and I give proper reference to where I found the solutions. So maybe you don’t need xauth for the X11 “tunnel”, but I didn’t change anything else than installing the xauth package – and than ssh -X worked. I would like to know how this could be achieved in a different way. Maybe the debian xauth-package makes necessary changes to scripts, who knows.
I am so happy I found this! After pulling my hair out all morning trying to get sshd to forward X11 properly – nobody else has this information listed. X11 tunelling works fine on feisty desktop installs out of the box with ssh, but NOT on the server edition without xauth. Thankyou.
Ran into the same problem till I hit this entry… Afterwards found this in sshd manpages:
If ~/.ssh/rc exists, runs it; else if /etc/ssh/sshrc exists, runs it; otherwise runs xauth. The â€œrcâ€ files are given the X11 authentication protocol and
cookie in standard input.
Actually never looked at it like “if all else fails, then we look for xauth”… but now I suspect it’s that little thing that got the best of us 😉
Hi, I need help
I’m connecting using ssh -X [email protected] from terminal (xterm or gnome-terminal)
When I run a swing java application, I get an error saying:
Exception in thread “main” java.awt.HeadlessException:
No X11 DISPLAY variable was set, but this program performed an operation which requires it”
When I set the DISPLAY variable, I get the following error:
Can’t connect to X11 window server using ‘xxx.xxx.x.xx:0.0’ as the value of the DISPLAY variable.
I’ve xauth installed on the server and X11Forwarding, ForwardAgent, and ForwardX11 set to ‘yes’
Hi Yohan, I actually have no idea, what the problem is, but you could use xhost (http://www.xfree86.org/current/xhost.1.html) to completely open the server for test cases. Apart from that – does it work with non-java applications, like start another xterm on the server?
Thank you so much for the wonderful post. The only one of its kind. We need an Ubuntu Server side page for tuts etc… also I like the idea of simply posting the solutions to your particular problems instead of full blown tuts (yeah I’m lazy like that :D)
many thanks again
I greatly needed this, thank you.
Search terms that would have helped me find it earlier, and may therefore help some future soul with this textual insertion: ubuntu server x11 forwarding ssh putty xming “cannot open display null”
Thank you! Quite helpful.
Extremely helpful. Thank you for making this available!
If you search this on ubuntuforums you will find some people suggesting all kinds of not so straightforward solutions. It is this simple and I didn’t find a solution in 3 hours of searching for one and yours is so nice. Thanks again.
Used it for the AP WebFeeds Manager java applet. Were basically using HardyLTS and forwarding X so we don’t have to install a complete install of X just to run a java applet on the server.
Thanks, I had this exact issue and your advice was correct.
For something that is “so easy” X11 is such a pain sometimes.
Someone may find useful that in previous Debian releases (at least “etch”) the package that contains xauth is named xbase-clients.
So you would need:
sudo apt-get install xbase-clients
Thanks for this post!