X11 forwarding - windows client works, linux doesn't

I have x11 forwarding enabled in /etc/ssh/sshd_config on a suse 11.2 32 bit box running kde

I can open x apps on a windows machine using xming and putty just fine, but when I boot the same machine into suse 11.2 64 bit using kde and try using konsole I get:

cannot connect to x server

The command I’m using to log in is: ssh -X -l username host

I doubt the problem is with the server I’m logging into or it wouldn’t work in windows, not really sure what to look for as I’ve never had a problem using x11 forwarding from a linux client before only windows ones

Any ideas?

Just as well no-one put any effort into helping me solve this or replying

Tried it again today - and it just worked

No idea what went on there as I haven’t changed a thing since trying it yestrday

A curse on those gremlins!

See it is better not to quickly try to answer a call for help. Sometimes they solve themselves (and with the gremlins of course).


That settup sounds really cool, is it hard to do? how does it compare to the free product from No Machine? (NX server /client)

I’m using NX like a windows terminal server (to connect to a RHEL environment) it works pretty well, and have heard of x11 forwarding but never attempted it. Sounds like it’d be a fun project, just to say I did it once.

Definitely hcw … not the first time I’ve had something really annoying just ‘sort itself out’ and I seriously doubt it’ll be the last :wink:

darnche mate it’s not all that difficult to do, I use nx a lot myself but you don’t always need to fire up a full desktop just to run one or two small programs

It’s often a lot simpler to create/edit config files on your server for example using something like kate (or kwrite) then using vi in a console … and you don’t need a full desktop to do it

Vi is great but it’s never gonna let you have all the files relating to say your http/php/mysql/webmail configs etc open on nice little tabs that you can click on with use of a mouse for ease of switching back’n forth

The setup is quite simple really, in the /etc/ssh/sshd_config file look for this parameter:


It will either look like:

X11Forwarding yes


#X11Forwarding yes
X11Forwarding no
#X11Forwarding no

Or it may just not be there … You need the first one, X11Forwarding yes

Add it or change it to suit, save the file and restart ssh (/etc/init.d/sshd restart as root)

Provided you already have a functioning sshd that you can successfully log into you now have x11 forwarding over ssh working on your server
(even handy for desktops if you’re like me and have them all over the place)

To login from a shell and have the capability to run x apps, instead of using just ssh -l user host You add -X as the first paramter, i.e.

ssh -X -l user host

Once you are logged in then you can run kwrite from the server on your desktop by typing kwrite in the shell

I always add a & after the command myself (like kwrite &) because this allows you to run other apps from the same shell without closing the first one you ran
(this would also close your app) or opening another shell, you usually have to press Ctrl + C to get back to the prompt to run another app when you’ve use the & suffix

To use it from a windows machine you need an x server emulator program, I’ve always found xming (available from sourceforge.net) to be excellent, comes with all required libraries etc built in and has an option to use putty with it on install

Putty is a great shell client for windows and if you enable this option on installing xming it has it’s own putty ‘fork’ bundled in that works brillianty alongside the xming interface(s),
and configuration is simpler than downloading a stand-alone copy of putty and various other x emulators

So, once you have that installed and running, use it’s Xlaunch tool, fill in the server and user info, connect, and type in the command to run whatever program you use

kmail is one I use a lot, I could be working on any of 4 machines when I wish to check mail, kmail is configured in my user profile on the server and I use either nx or x11 forwarding
whichever’s most convenient at the time, to manage mails from either any local machine, or even a remote machine when necessary

Why fire up a complete nx desktop to look at mails you’ve already downloaded onto your machine when you’re in another part of the building or off-site

Nx is awesome, but for me x11 forwarding for me is still extremely handy (The issue had only cropped because I had some drives etc to change and decided it was a good time to upgrade from suse 11 to 11.2)

There are other ways to do ssh in from windows and have x11 capabilities, most results on google you’ll find use putty, so if you wanna check some other options out googling x11 forwarding using putty will return pretty specific results

I’ve tried no end of them over the past few years and I always keep going back to xming, nothing I’ve come across does it better or easier, so I guess that’s the one I’d recommend if you wanna acces your x apps from windows

And the last thing I expect to end up doing when I started the thread was to end up typing all that out!

But hey we’re all here to help each other and I hope it helps ya learn something new to you and that you find it useful :wink:

I tried to edit that due to typos and making some parts more sensible, but my ten minutes had ran out, hit submit instead of preview by accident lol

Any bits that aren’t clear just ask and I’ll clarify them, but not until tomorrow cos it’s fast approaching sleep-time here in the uk


Thanks for that great write up. I checked out the X forwarding via ssh on a test box and it is pretty cool. I can see me using this in the future for managing my RHEL. I’m setting it up on all my Redhat servers today. THANKS!!! to be honest, I don’t think I would have spent the time to research this or try it if it was not for this thread, so THANKS AGAIN!!!

X11 forwarding isn’t a new thing mate it’s been around for years, I seem to recall vnc needing x11 forwarding if you tunnel it through ssh

Not that I’ve used vnc since nx came on the scene

Glad I was able to bring it to your attention and do my bit in helping ya get it working