newspaint

Documenting Problems That Were Difficult To Find The Answer To

Putty Can’t Connect To X11 Display Via Socks Proxy

I spent hours trying to figure out this problem. The short story is that version 0.60 and the latest release version (beta 0.62) of Putty on Windows 7 64-bit cannot forward X11 on a connection using a SOCKS proxy.

The fix is simple – download the latest development snapshot of Putty – which on build 2012-10-26:r9690 appeared to fix my issue.

Set-Up

I had a ssh tunnel to my target machine with a local SOCKS proxy – using ssh on a Linux server at home and with the -D command-line switch.

I was running Xming on my Windows 7 64-bit desktop.

I was using Putty version 0.60:

Putty About Screen for Version 0.60

Putty About Screen for Version 0.60

I set up a Putty connection to my target server via my SOCKS proxy port:

Putty Configuration Window for Using SOCKS Proxy

Putty Configuration Window for Using SOCKS Proxy

Then I configured my connection to use X11 forwarding (no need to fill out the DISPLAY variable part):

Putty Configuration for X11 Forwarding

Putty Configuration for X11 Forwarding

Now – if I had set my proxy up to use SOCKS5 then I’d get the following response after connecting to the server:

user@server:~$ echo $DISPLAY
localhost:13.0
user@server:~$ xhost
xhost:  unable to open display "localhost:13.0"
user@server:~$ xclock
Error: Can't open display: localhost:13.0

Strange – the DISPLAY environment variable was being set correctly but a display couldn’t be opened.

I tried changing my proxy type to SOCKS4. Then when I typed the command “xhost” I got the following crash:

Putty Crashing When X Command Sent Over SOCKS4 Proxy

Putty Crashing When X Command Sent Over SOCKS4 Proxy

Trying Using 0.62-beta

I tried using the latest release version (0.62-beta).

Putty About Box for Latest Release 0.62-Beta

Putty About Box for Latest Release 0.62-Beta

But this version also crashed using SOCKS4 proxy type.

Using Latest Development Snapshot of Putty

I downloaded the latest development snapshot of putty (which happened to be 2012-10-26:r9690 at the time):

Putty About Screen for Latest Development Snapshot

Putty About Screen for Latest Development Snapshot

Now when I logged into my server I got the following (and xclock worked):

user@server:~$ echo $DISPLAY
localhost:16.0
user@server:~$ xhost
access control enabled, only authorized clients can connect
INET:192.168.10.147    (no nameserver response within 5 seconds)
LOCAL:
INET:localhost

Great! It is working with Xming.

Post Script

There are a lot of articles on the Internet about how X11 forwarding won’t authenticate when using a different user to the one you first connect as (e.g. if you sudo to root after connecting). This was not my problem here. However I did initially get Putty authentication problems at first – which may or may not have been related to the SOCKS problems with the older Putty clients. The message was:

PuTTY X11 proxy: wrong authentication protocol attemptedPuTTY X11 proxy: wrong authentication protocol attemptedPuTTY X11 proxy: wrong authentication protocol attemptedPuTTY X11 proxy: wrong authentication protocol attemptedxhost: unable to open display “localhost:10.0”

… or in other words:

PuTTY X11 proxy: wrong authentication protocol attempted

Deleting the ~/.Xauthority file may be a very good start if you haven’t sudo’d into another user account.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: