5

I am having problems with this and I don't know why. There are many related questions but none of them helped me.

I have two VMs:
CentOS 7 with GNOME 192.168.1.53
Mint 17.1 Rebbeca with XFCE 192.168.1.54

I know that by default exporting the display should be strait forward, like:

#While I am Logged in on the desktop on the MINT:
user@mint:~$ xhost +

#I am SSHing to the Centos from the MINT
user@mint:~$ ssh -XY root@192.168.1.53

#At the CentOS I export the display 
[root@cent ~]$ export DISPLAY=192.168.1.54:0.0
[root@cent ~]$ echo $DISPLAY
192.168.1.54:0.0

#Trying to start a simple program but I get an error message instead:
[root@cent ~]$ xclock
Error: Can't open display: 192.168.1.54:0.0

What I am doing wrong?

I tried the suggestions on a number of forums but I still get the error message. I also tried to export the display from the Mint to the Centos (the oposite way) and I still get the same error but this time on the Mint.

Could it be that the error is because one system has XFCE and the other GNOME?
I am thinking that there may be some default security settings in effect on one/both of the distros for which I am not aware of.

I also tried to eddit the /etc/gdm/custom.conf on the CentOS as explained here:
http://www.softpanorama.org/Xwindows/Troubleshooting/can_not_open_display.shtml

Spirit
  • 225

2 Answers2

13

You're trying to create an X tunnel through SSH then overriding it by specifying an IP address which bypasses the SSH tunnel. This doesn't work. When SSH tunnelling, SSH deals with transferring data between the local and remote IP addresses by opening a port on localhost on each machine it speaks to. You don't get to specify the IP address of either computer.

You need to export the display that is tunnelled through SSH, and that means export DISPLAY=localhost:x.y, which should have been done for you automatically when you connect using ssh -X.

  • 1
    MFW I feel so stupid I just want to size to exist... Thanks .. – Spirit Jun 18 '15 at 20:51
  • 1
    On the other hand, when I do ssh -XY root@192.168.1.53 then on echo $DISPLAY the output is localhost:10.0 which is a little confusing.. – Spirit Jun 18 '15 at 20:53
  • @Spirit: localhost:10.0 is exactly what it should be. You'll get used to it one day, most things when tunnelled through SSH become localhost:xyz – Circus Cat Jun 19 '15 at 09:19
  • Does that mean that export DISPLAY was originally intended to be used with telnet? – Spirit Jun 19 '15 at 11:30
  • Sort of, since when export DISPLAY was created, only rlogin & telnet existed, and ssh was still years in the future. – alanc Jun 20 '15 at 22:14
4

Are yo trying to use SSH for forwarding, or not. It seems like you are trying to mix + match two methods here. One for forwarding with SSH, and that isn't used for ssh.

If you want to forward via SSH all you should have to do on your client is ssh -X remotehost. You shouldn't need to do anything in your session on the server once you have connected. No xhost, or exporting is required.

One thing I do wonder though is if your SSH server is properly setup for X11 forwarding. This is an option that isn't always on by default. See your sshd_config X11Forwarding setting.

Zoredache
  • 3,640