X11 forwarding doesn't work

hi,

I'm trying to run a bash script that starts GUI. Though it says application started when I run this bash script doesn't show up any GUI. Here is what I've tried so far and please let me know if I'm missing something with the X11 set up here.

cat /etc/redhat-release
Red Hat Enterprise Linux Server release 6.9 (Santiago)

rpm -qa | grep xorg-x11-xauth
xorg-x11-xauth-1.0.9-1.el6.x86_64

cat /etc/hosts|grep 127.0.0.1
127.0.0.1  localhost localhost.localdomain

cat /etc/ssh/sshd_config|grep X11
X11Forwarding yes
X11DisplayOffset 10
X11UseLocalhost yes

cat /etc/ssh/ssh_config|grep X11
ForwardX11 yes

Also enabled X11 forward in putty session and set Xdisplay location :0.0

However when I try xclock this is what I see..

$xclock
Error: Can't open display: localhost:11.0

Hello,

Can anyone help me fixing this problem?

You probably need to set the DISPLAY variable pointing to the host with the display you want xclock to show up at.

On this host you may also need to issue xhost to allow the host originating the xclock to display the clock window there.

I hope this helps.

bakunin

Are you sitting at a Windows desktop?
If yes, did you install an X-server on it, like Xming or Cygwin/X or ...?
The (insecure) xhost -allow and manual DISPLAY setting should not be necessary if there is the (much safer) ssh X-forwarding enabled.

I'm not doing any SSH here. I'm trying to run a script on the local host machine itself. Just opened a putty session , enabled X11 forwarding by setting the X display location as

:0.0

and trying to run a script that should open a GUI. I have also set below lines in /etc/hosts file but no luck yet

127.0.0.1           localhost localhost.localdomain
::1                     localhost localhost.localdomain
xclock
Error: Can't open display: localhost:10.0

On a local host, what do you need putty for? putty , amongst other features, does an ssh connect / session.
On the local server, is there an X-server running? How does xclock convert display :0.0 to :10.0 ?

You might have to go for xming. This is easy one.
As i understand you correct, you are opening a putty session and triggering a script.
Im assuming, you are using a windows desktop where this putty tool is available for you and the port 22 to the host you are connecting is allowed to this windows desktop.

You might need to install xming in this windows desktop in that case.

Download link :
Xming X Server for Windows download | SourceForge.net

Installing and configuring :
http://www.geo.mtu.edu/geoschem/docs/putty_install.html

Once you are done,
-> Start your xserver in your desktop
-> Click Xlaunch - next - next -next - done
-> Open putty
-> Provide the SSH informations ( Display parameter as localhost:<xserver display parameter> and allow x11 forwarding )

and trigger your script and it should work.

Please make sure .Xauthority file is getting created in your home dir
You may need to install other packages like,
xauth
xterm

I will provide you some commands for required packages and it defnitely works

yum -y install xauth* xorg-x11-server-Xorg* xorg-x11-server-utils* xorg-x11-drv* xorg-x11-glamor* xorg-x11-xinit* xorg-x11-drivers* xterm xclock xeyes firefox
1 Like

hi Jayadeava,

Yes, I'm using putty on a windows desktop to connect to red hat server and to run script. Thanks for the info in your comments and now I'm able to launch GUI version of script. May sound weird, but is there a way we can have this Xming(kind of tools) installed at Red Hat Linux OS layer and directly start GUI from there instead of invoking from Windows Desktop?

Free alternatives are VNC, Open NX.
Commercial alternatives are Citrix, ThinLinc, NoMachine NX.
The NX client uses the ssh protocol like putty.