10

I communicate with the server via a ssh tunnel, configured via Putty.

Recently, I'm trying to forward the X11 through it, but it doesn't work.

Is there any one work this way?

Searched with google, but didn't find anything.

5
  • 2
    With regular OpenSSH, you should be able to pass the -X flag and X forward, but I'm not sure how that would be accomplished over a TCP port. Dec 14, 2015 at 3:38
  • 3
    If you are using PuTTY does that mean that the host from which you are connecting to the server is running MS Windows? If so, then you would need an X server running on Windows that is configured to accept TCP connections. Dec 14, 2015 at 5:30
  • 2
    You wrote 'it doesn't work'. In future questions, please explain in what way it doesn't work: what you tried, what error messages you see, what relevant log messages, and what behavior you saw.
    – dcorking
    Dec 14, 2015 at 10:54
  • If you are using Debian, take a look at: superuser.com/a/862647/391087 Dec 14, 2015 at 12:32
  • Yes, but you'll need an X server on your local machine (I have VcXsrv). Bear in mind that the X11 protocol is extremely latency-sensitive because it tends to need lots of synchronous draw calls that require full network round-trips one after another, so it's not very efficient over the Internet. I now mainly use VNC over SSH instead.
    – bwDraco
    Dec 14, 2015 at 17:56

3 Answers 3

15

Yes, this is possible in a few different ways but you will need an X window server for Windows. Some options of a X windows server are XManager, XMing and MobaXterm. Once you have an X server running on Windows you can use PuTTY to connect to your host after you have set the configuration parameters:

Connection/SSH/X11
  Enable X11 forwarding
  X display location: localhost:10.0

Where the 10.0 depends on what the X Window server is listening on.

When you configured the X Window server and PuTTY and logged in to your host you can verify the DISPLAY variable if a DISPLAY is set:

$ echo $DISPLAY
localhost:10.0

Then try something like xclock to see if X11 forwarding works:

# xclock &

Another way to use X11 apart from ssh is to set the DISPLAY variable manually to point to an IP address like:

# export DISPLAY=192.168.0.1:0

And see if it works:

# xclock &

This way X applications are (re)directed to output to a remote X Window server.

Note: Keep in mind that the X11 protocol is not designed to operate over slow network (WAN) connections. The X application may be terrible slow when used over slow connections. Consider to use the -C (compression) switch with ssh to use compression over the ssh session to speed it up a little.

2
  • Small wording issue there: What he needs is an X Window server. A window manager would usually be included in such an installation, but isn't 100% necessary, and could even be run on the remote machine. Dec 14, 2015 at 8:18
  • I was able to pull this off without any configurations on the SSH. Xming already has PuTTY, so, it is one configuration down. Also, this may require you to login everytime your session ends. You can look at superuser.com/a/862647/391087 or askubuntu.com/q/426831/377328 to solve that issue, if it is an issue for you. Dec 14, 2015 at 12:36
3

Hi if you want to use the putty like use Openssh with -x you have to install XMING on your windows machine . it became like some sort of server then you have to config you putty to forward X11 of you ssh connection over this server

Download Xming

You can use this tutorials

1
  • XMING is one good solution, but not the only one. Dec 14, 2015 at 8:20
1

Yet another solution is to install Cygwin on your Windows machine. It has both ssh client and X11 server (be sure to install the corresponding packages).

Keep in mind that many X11 installations forbid untrusted X forwarding. Perhaps the simplest way around this is to use -Y option in ssh

ssh -Y user@server
xclock
1
  • 1
    Just like the terms "client" and "server", be careful of the terms "trusted" and "untrusted". A "trusted" connection is one where several of the usual security controls are disabled - i.e. you trust the system you are connecting to not to bad things to you.
    – symcbean
    May 9, 2018 at 9:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .