View previous topic :: View next topic |
Author |
Message |
ct85711 Veteran
Joined: 27 Sep 2005 Posts: 1791
|
Posted: Thu Apr 18, 2013 6:36 pm Post subject: [solved] X11 forwarding through ssh |
|
|
I'm having troubles getting X11 forwarding through ssh to work; I've got X11 forward enabled in sshd_config, and made sure X11 forwarding is enabled on the client too. I am only trying to get a individual application to forward; and been getting "cannot connect to X server localhost:10.0" when ever I try to launch the application. The server machine, has xdm running, and is pretty much a headless machine, I only have a monitor temporarily connected to assist on setting up the machine. The client machine is a windows machine connecting with putty.
Code: |
@omega ~ $ echo $DISPLAY
localhost:10.0
@omega ~ $ kdevelop
kdevelop: cannot connect to X server localhost:10.0
@omega ~ $ xhost +
xhost: unable to open display "localhost:10.0"
|
I've managed, to get xdm to listen to tcp connections; and telnet 127.0.0.1 6000 works fine. So I know xdm is listening.
Here's my sshd_config set up (commented items removed).
Code: |
PasswordAuthentication no
UsePAM yes
AllowAgentForwarding yes
AllowTcpForwarding yes
X11Forwarding yes
X11UseLocalhost yes
PrintMotd no
PrintLastLog no
UsePrivilegeSeparation sandbox
Subsystem sftp /usr/lib64/misc/sftp-server
|
Code: |
[ebuild R ] net-misc/openssh-6.1_p1-r1 USE="X hpn kerberos ldap pam tcpd -X509 -bindist -ldns -libedit (-selinux) -skey -static" 0 kB
|
Last edited by ct85711 on Fri Apr 19, 2013 1:34 am; edited 1 time in total |
|
Back to top |
|
|
Hypnos Advocate
Joined: 18 Jul 2002 Posts: 2889 Location: Omnipresent
|
Posted: Thu Apr 18, 2013 7:47 pm Post subject: |
|
|
You do have the "X" USE flag enabled, which pulls in xauth so that forwarding can work. This is the usual mistake people make.
What do you see when you run ssh with verbosity increased via, e.g. "ssh -v" or "ssh -vv" or "ssh -vvv" ?
Also, here is my sshd_config (I have a similar scenario as you):
Code: | PasswordAuthentication no
UsePAM yes
X11Forwarding yes
PrintMotd no
PrintLastLog no
Subsystem sftp /usr/lib64/misc/sftp-server |
I'm using openssh-5.9_p1-r4 . _________________ Personal overlay | Simple backup scheme |
|
Back to top |
|
|
eccerr0r Watchman
Joined: 01 Jul 2004 Posts: 9678 Location: almost Mile High in the USA
|
Posted: Thu Apr 18, 2013 7:53 pm Post subject: |
|
|
if ssh is working properly, it should automatically create the correect DISPLAY value on the forwarding listener - meaning if you had to set the DISPLAY variable manually, likely ssh did not set up the tunnel properly.
Is both client and server using same openssh?
Also be careful when you specify X server. The X server tends to be the machine you're looking at and typing on, the X client is the software application. That being said, the "Server" (not X server) does not need to be running xdm at all (but it needs all the X libraries installed), it needs not run anything but any X client software upon demand.
The behavior on openssh, all I need to do is ssh from my client machine to the server machine. Some setups I need to specify ssh -X depending on the X forwarding policy... but $DISPLAY tends to get automatically set when things are configured correctly and the tunnel is created.
You could also look into VNC as it may be less confusing to get working. In this situation the "server" can run an X VNC server, and your vnc client can connect to the VNC server. _________________ Intel Core i7 2700K/Radeon R7 250/24GB DDR3/256GB SSD
What am I supposed watching? |
|
Back to top |
|
|
toralf Developer
Joined: 01 Feb 2004 Posts: 3922 Location: Hamburg
|
Posted: Thu Apr 18, 2013 8:05 pm Post subject: |
|
|
What does or better show ? Furthermore you restarted sshd after the config changes ? |
|
Back to top |
|
|
ct85711 Veteran
Joined: 27 Sep 2005 Posts: 1791
|
Posted: Thu Apr 18, 2013 8:21 pm Post subject: |
|
|
Yes, I have X use flag enabled, along with all the necessary packages installed. As far as setting up DISPLAY, that part is created automatically, so nothing was manually setup for that. So the tunnel is setup properly for that part.
Again, my server is using openssh version 6.1_p1-r1; the client is a windows machine connecting with putty version 0.6.2. So I am not able to do "ssh -v -X" or adjust the verbose any on the client side.
I have tried the various vnc setups; and they either didn't work (won't connect), was way too laggy (which shouldn't be a problem on a local network), or it wanted to use the display settings for my temporary monitor on the server (which is using a res of 1920x1080), making it unusable on my other machines.
As far as the settings changed in the config, I have both reloaded ssh via /etc/init.d/sshd reload and also tried restarting the computer. |
|
Back to top |
|
|
Hypnos Advocate
Joined: 18 Jul 2002 Posts: 2889 Location: Omnipresent
|
Posted: Thu Apr 18, 2013 8:29 pm Post subject: |
|
|
Do you have another Linux machine to test whether X11 forwarding is working? If it works there, then the issue is with putty + whatever X server you're running on the Windows machine.
If you want a Linux-y environment on Windows, use Cygwin . _________________ Personal overlay | Simple backup scheme |
|
Back to top |
|
|
eccerr0r Watchman
Joined: 01 Jul 2004 Posts: 9678 Location: almost Mile High in the USA
|
Posted: Thu Apr 18, 2013 10:21 pm Post subject: |
|
|
I think your Linux/server is actually most likely working just fine, it's your windows machine that's the problem.
Yes, it would be helpful to know what X server you're using on the windows machine, because Windows does not come with one, and will fail X11 all connections brought to it. I have used Cygwin before and this does come with an X server that you can use.
I found that VNC tends to be better than forwarding X11 if you have an unstable network (specifically, portable machines/wireless) and worth the annoyances it comes with, as well as with dealing with Windows. Besides newer VNC servers support xrandr to change the desktop size... You don't want to use x11vnc, you should be setting up your own virtual X vnc server, and it should not be tied with the video card on the server at all. _________________ Intel Core i7 2700K/Radeon R7 250/24GB DDR3/256GB SSD
What am I supposed watching? |
|
Back to top |
|
|
ct85711 Veteran
Joined: 27 Sep 2005 Posts: 1791
|
Posted: Fri Apr 19, 2013 1:33 am Post subject: |
|
|
Well, I finally got it working. Thank you all for your assistance. It seems, this stuff changed a lot more than I expected in the last 10 years (most of that being away in the military). My problem ended up being the lack of of a X server on my windows machine; which was not necessary several years prior. The programs I intend to use through ssh, is only 2D graphics, with most of the space being mostly text. So I don't see any issue where any semi recent video card will have a problem running the application. |
|
Back to top |
|
|
Hypnos Advocate
Joined: 18 Jul 2002 Posts: 2889 Location: Omnipresent
|
Posted: Fri Apr 19, 2013 3:45 am Post subject: |
|
|
If you were throwing X windows from the remote machine to your local machine, an X server has always been required on your local machine. It's simply a matter of handling the protocol.
It's possible that the software you used previously included a rudimentary X server, e.g. Xming . _________________ Personal overlay | Simple backup scheme |
|
Back to top |
|
|
|