Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[solved] X11 forwarding through ssh
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

 
Reply to topic    Gentoo Forums Forum Index Desktop Environments
View previous topic :: View next topic  
Author Message
ct85711
Veteran
Veteran


Joined: 27 Sep 2005
Posts: 1791

PostPosted: Thu Apr 18, 2013 6:36 pm    Post subject: [solved] X11 forwarding through ssh Reply with quote

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
View user's profile Send private message
Hypnos
Advocate
Advocate


Joined: 18 Jul 2002
Posts: 2889
Location: Omnipresent

PostPosted: Thu Apr 18, 2013 7:47 pm    Post subject: Reply with quote

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
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 9601
Location: almost Mile High in the USA

PostPosted: Thu Apr 18, 2013 7:53 pm    Post subject: Reply with quote

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
View user's profile Send private message
toralf
Developer
Developer


Joined: 01 Feb 2004
Posts: 3919
Location: Hamburg

PostPosted: Thu Apr 18, 2013 8:05 pm    Post subject: Reply with quote

What does
Code:
ssh -v -X ...
or better
Code:
ssh -v -Y ...
show ? Furthermore you restarted sshd after the config changes ?
Back to top
View user's profile Send private message
ct85711
Veteran
Veteran


Joined: 27 Sep 2005
Posts: 1791

PostPosted: Thu Apr 18, 2013 8:21 pm    Post subject: Reply with quote

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
View user's profile Send private message
Hypnos
Advocate
Advocate


Joined: 18 Jul 2002
Posts: 2889
Location: Omnipresent

PostPosted: Thu Apr 18, 2013 8:29 pm    Post subject: Reply with quote

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
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 9601
Location: almost Mile High in the USA

PostPosted: Thu Apr 18, 2013 10:21 pm    Post subject: Reply with quote

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
View user's profile Send private message
ct85711
Veteran
Veteran


Joined: 27 Sep 2005
Posts: 1791

PostPosted: Fri Apr 19, 2013 1:33 am    Post subject: Reply with quote

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
View user's profile Send private message
Hypnos
Advocate
Advocate


Joined: 18 Jul 2002
Posts: 2889
Location: Omnipresent

PostPosted: Fri Apr 19, 2013 3:45 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Desktop Environments All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum