Problem description:
When I set the hostname to localhost.localdomain the DISPLAY variable is set
to 127.0.0.1:10.0 when logging in (ssh -X), and e.g. xclock works fine.
When I set the hostname to "myserver.dns.name" the DISPLAY variable is set to
"myserver.ip.address:10.0" when logging in; xclock does not open and after
around two minutes I get this message:
Error: Can't open display: myserver.ip.address:10.0
However, it does work when opening ports 6000:6020 in iptables.
I've looked at this:
- xauth is installed
- enabling/disabling ipv6 does not change anything
- setting selinux to permissive or disabled didn't work
- tried "ssh -vvv -X" and this error shows when it's not working: "debug3: Ignored env DISPLAY"
- tried to set "AddressFamily inet" and "ListenAddress 0.0.0.0"
- "X11UseLocalhost yes" does not work
- ssh login tested from CentOS 6 and windows (Xwin32 and cygwin/X).
- deleted .Xauthority
- when manually setting the DISPLAY variable to 127.0.0.1:10.0 I get this:
X11 connection rejected because of wrong authentication.
Error: Can't open display: 127.0.0.1:10.0
- didn't find anything relevant at the forum
Obviously the DISPLAY variable isn't set correctly, but why and how to fix it?
Any ideas?
[SOLVED] ssh X11 forwarding doesn't work when hostname is set
[SOLVED] ssh X11 forwarding doesn't work when hostname is set
Last edited by tunk on 2017/05/25 11:53:29, edited 1 time in total.
Re: ssh X11 forwarding doesn't work when hostname is set
What is the contents of your /etc/hosts?
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke
Re: ssh X11 forwarding doesn't work when hostname is set
Here's my /etc/hosts:
Code: Select all
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
myserver1.ip.address myserver1.dns.name myserver1
myserver2.ip.address myserver2.dns.name myserver2
myserver3.ip.address myserver3.dns.name myserver3
.....
Re: ssh X11 forwarding doesn't work when hostname is set
Are you sure that X11UseLocalhost is not being set to no somewhere? Your symptoms match exactly what would be expected if it were and my tests here always set DISPLAY to localhost:x.0 and X11UseLocalhost is defaulted to yes (i.e. not set in the config file).
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke
Re: ssh X11 forwarding doesn't work when hostname is set
thanks,
yes it was set to "no" in /etc/ssh/sshd_config.
Unfortunately, setting it to "yes" makes it worse:
- same result with hostname "myserver.dns.name"
- for localhost.localdomain DISPLAY is set to localhost.localdomain:0 and xclock gives this:
Error: Can't open display: localhost.localdomain:0
yes it was set to "no" in /etc/ssh/sshd_config.
Unfortunately, setting it to "yes" makes it worse:
- same result with hostname "myserver.dns.name"
- for localhost.localdomain DISPLAY is set to localhost.localdomain:0 and xclock gives this:
Error: Can't open display: localhost.localdomain:0
Re: ssh X11 forwarding doesn't work when hostname is set
Solved.
I thought I had tried all combinations of settings. Obviously I hadn't.
Setting this in /etc/ssh/sshd_config works:
AddressFamily inet
X11Forwarding yes
I guess disabling ipv6 requires "AddressFamily inet".
I thought I had tried all combinations of settings. Obviously I hadn't.
Setting this in /etc/ssh/sshd_config works:
AddressFamily inet
X11Forwarding yes
I guess disabling ipv6 requires "AddressFamily inet".