You are not logged in.

#1 2013-01-11 05:32:23

gixr
Member
Registered: 2013-01-11
Posts: 5

X11 Forwarding with SSH not working [SOLVED]

I'm trying to follow the X11 forwarding guide on the wiki but to no avail.

I'm using Putty and Xming from a Windows machine to SSH into the ArchLinux machine over my home network.

When I log in through SSH with X11 forwarding enabled, my display variable is set to "localhost:10.0". Running xclock gives me the following error: "Error: Can't open display: localhost:10.0".

I'm pretty sure Xming isn't the problem, since if I manually change the DISPLAY variable to "[my windows machine IP]:0.0", I can run xclock and see it appear.

From what I can see, it should be working.

Complete sshd_config below:

#    $OpenBSD: sshd_config,v 1.87 2012/07/10 02:19:15 djm Exp $

# This is the sshd server system-wide configuration file.  See
# sshd_config(5) for more information.

# This sshd was compiled with PATH=/usr/bin:/bin:/usr/sbin:/sbin

# The strategy used for options in the default sshd_config shipped with
# OpenSSH is to specify options with their default value where
# possible, but leave them commented.  Uncommented options override the
# default value.

#Port 22
#AddressFamily any
#ListenAddress 0.0.0.0
#ListenAddress ::

# The default requires explicit activation of protocol 1
#Protocol 2

# HostKey for protocol version 1
#HostKey /etc/ssh/ssh_host_key
# HostKeys for protocol version 2
#HostKey /etc/ssh/ssh_host_rsa_key
#HostKey /etc/ssh/ssh_host_dsa_key
#HostKey /etc/ssh/ssh_host_ecdsa_key

# Lifetime and size of ephemeral version 1 server key
#KeyRegenerationInterval 1h
#ServerKeyBits 1024

# Logging
# obsoletes QuietMode and FascistLogging
#SyslogFacility AUTH
#LogLevel INFO

# Authentication:

#LoginGraceTime 2m
PermitRootLogin no
#StrictModes yes
#MaxAuthTries 6
#MaxSessions 10

#RSAAuthentication yes
#PubkeyAuthentication yes

# The default is to check both .ssh/authorized_keys and .ssh/authorized_keys2
# but this is overridden so installations will only check .ssh/authorized_keys
AuthorizedKeysFile    .ssh/authorized_keys

#AuthorizedPrincipalsFile none

# For this to work you will also need host keys in /etc/ssh/ssh_known_hosts
#RhostsRSAAuthentication no
# similar for protocol version 2
#HostbasedAuthentication no
# Change to yes if you don't trust ~/.ssh/known_hosts for
# RhostsRSAAuthentication and HostbasedAuthentication
#IgnoreUserKnownHosts no
# Don't read the user's ~/.rhosts and ~/.shosts files
#IgnoreRhosts yes

# To disable tunneled clear text passwords, change to no here!
#PasswordAuthentication yes
#PermitEmptyPasswords no

# Change to no to disable s/key passwords
ChallengeResponseAuthentication no

# Kerberos options
#KerberosAuthentication no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes
#KerberosGetAFSToken no

# GSSAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes

# Set this to 'yes' to enable PAM authentication, account processing,
# and session processing. If this is enabled, PAM authentication will
# be allowed through the ChallengeResponseAuthentication and
# PasswordAuthentication.  Depending on your PAM configuration,
# PAM authentication via ChallengeResponseAuthentication may bypass
# the setting of "PermitRootLogin without-password".
# If you just want the PAM account and session checks to run without
# PAM authentication, then enable this but set PasswordAuthentication
# and ChallengeResponseAuthentication to 'no'.
UsePAM yes

#AllowAgentForwarding yes
AllowTcpForwarding yes
#GatewayPorts no
X11Forwarding yes
X11DisplayOffset 10
X11UseLocalhost yes
PrintMotd yes
#PrintLastLog yes
#TCPKeepAlive yes
#UseLogin no
UsePrivilegeSeparation sandbox        # Default for new installations.
#PermitUserEnvironment no
#Compression delayed
#ClientAliveInterval 0
#ClientAliveCountMax 3
#UseDNS yes
#PidFile /run/sshd.pid
#MaxStartups 10
PermitTunnel yes
#ChrootDirectory none
#VersionAddendum none

# no default banner path
Banner /etc/issue

# override default of no subsystems
Subsystem    sftp    /usr/lib/ssh/sftp-server

# Example of overriding settings on a per-user basis
#Match User anoncvs
#    X11Forwarding no
#    AllowTcpForwarding no
#    ForceCommand cvs server

Last edited by gixr (2013-01-11 22:37:35)

Offline

#2 2013-01-11 07:59:37

Ztjuh
Member
Registered: 2011-05-30
Posts: 58

Re: X11 Forwarding with SSH not working [SOLVED]

It's easy.

Start Xming.

Configure SSH (here's my confg):

#       $OpenBSD: sshd_config,v 1.84 2011/05/23 03:30:07 djm Exp $

# This is the sshd server system-wide configuration file.  See
# sshd_config(5) for more information.

# This sshd was compiled with PATH=/usr/bin:/bin:/usr/sbin:/sbin

# The strategy used for options in the default sshd_config shipped with
# OpenSSH is to specify options with their default value where
# possible, but leave them commented.  Uncommented options override the
# default value.

Port 22
#AddressFamily any
#ListenAddress 0.0.0.0
#ListenAddress ::

# The default requires explicit activation of protocol 1
#Protocol 2

# HostKey for protocol version 1
#HostKey /etc/ssh/ssh_host_key
# HostKeys for protocol version 2
#HostKey /etc/ssh/ssh_host_rsa_key
#HostKey /etc/ssh/ssh_host_dsa_key
#HostKey /etc/ssh/ssh_host_ecdsa_key

# Lifetime and size of ephemeral version 1 server key
#KeyRegenerationInterval 1h
#ServerKeyBits 1024

# Logging
# obsoletes QuietMode and FascistLogging
#SyslogFacility AUTH
#LogLevel INFO

# Authentication:

#LoginGraceTime 2m
PermitRootLogin no
#StrictModes yes
#MaxAuthTries 6
#MaxSessions 10

#RSAAuthentication yes
#PubkeyAuthentication yes

# The default is to check both .ssh/authorized_keys and .ssh/authorized_keys2
# but this is overridden so installations will only check .ssh/authorized_keys
AuthorizedKeysFile      .ssh/authorized_keys

# For this to work you will also need host keys in /etc/ssh/ssh_known_hosts
#RhostsRSAAuthentication no
# similar for protocol version 2
#HostbasedAuthentication no
# Change to yes if you don't trust ~/.ssh/known_hosts for
# RhostsRSAAuthentication and HostbasedAuthentication
#IgnoreUserKnownHosts no
# Don't read the user's ~/.rhosts and ~/.shosts files
#IgnoreRhosts yes

# To disable tunneled clear text passwords, change to no here!
#PasswordAuthentication yes
#PermitEmptyPasswords no

# Change to no to disable s/key passwords
ChallengeResponseAuthentication no

# Kerberos options
#KerberosAuthentication no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes
#KerberosGetAFSToken no

# GSSAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes

# Set this to 'yes' to enable PAM authentication, account processing,
# and session processing. If this is enabled, PAM authentication will
# be allowed through the ChallengeResponseAuthentication and
# PasswordAuthentication.  Depending on your PAM configuration,
# PAM authentication via ChallengeResponseAuthentication may bypass
# the setting of "PermitRootLogin without-password".
# If you just want the PAM account and session checks to run without
# PAM authentication, then enable this but set PasswordAuthentication
# and ChallengeResponseAuthentication to 'no'.
UsePAM yes

#AllowAgentForwarding yes
AllowTcpForwarding yes
#GatewayPorts no
X11Forwarding yes
X11DisplayOffset 10
#X11UseLocalhost yes
#PrintMotd yes
#PrintLastLog yes
#TCPKeepAlive yes
#UseLogin no
#UsePrivilegeSeparation yes
#PermitUserEnvironment no
#Compression delayed
#ClientAliveInterval 0
#ClientAliveCountMax 3
#UseDNS yes
#PidFile /run/sshd.pid
#MaxStartups 10
#PermitTunnel no
#ChrootDirectory none

# no default banner path
#Banner none

# override default of no subsystems
Subsystem       sftp    /usr/lib/ssh/sftp-server

# Example of overriding settings on a per-user basis
#Match User anoncvs
#       X11Forwarding no
#       AllowTcpForwarding no
#       ForceCommand cvs server

Putty setting: http://i.ztjuh.tk/20130111075624803.png

Click on Open and run your program smile

Last edited by Ztjuh (2013-01-11 08:01:00)

Offline

#3 2013-01-11 14:10:15

gixr
Member
Registered: 2013-01-11
Posts: 5

Re: X11 Forwarding with SSH not working [SOLVED]

Apparently you didn't read my post. I have my setup identical to that. The X11 forwarding just isn't working.

Last edited by gixr (2013-01-11 14:10:45)

Offline

#4 2013-01-11 15:12:11

nomorewindows
Member
Registered: 2010-04-03
Posts: 3,362

Re: X11 Forwarding with SSH not working [SOLVED]

You have to also enable the forwarding in /etc/ssh/ssh_config as well as sshd_config, and then reload/restart sshd.


I may have to CONSOLE you about your usage of ridiculously easy graphical interfaces...
Look ma, no mouse.

Offline

#5 2013-01-11 15:52:04

Painless
Member
Registered: 2006-02-06
Posts: 233

Re: X11 Forwarding with SSH not working [SOLVED]

ssh_config doesn't apply in this case since the client is Windows.

Sounds like an old ~/.Xauthority is present.  Check the datestamp of the file.  If it not recent, try deleting ~/.Xauthority before logging in again so that a new ~/.Xauthority file gets created.  It should pick up the correct settings and work on localhost:10.0.

Offline

#6 2013-01-11 16:34:36

gixr
Member
Registered: 2013-01-11
Posts: 5

Re: X11 Forwarding with SSH not working [SOLVED]

Deleted ~/.Xauthority, rebooted. Logged in, got a message saying .Xauthority was missing, and it was regenerated. Logged out and logged back in. Still get the same error: "Error: Can't open display: localhost:10.0" when trying to run any X client program.

I also double checked the putty and Xming combo wasn't the problem by logging into my university's linux server which has X11 forwarding enabled, and everything worked fine.

Offline

#7 2013-01-11 16:54:50

nomorewindows
Member
Registered: 2010-04-03
Posts: 3,362

Re: X11 Forwarding with SSH not working [SOLVED]

Can you send a client to the Xming server?  xterm -display <Xming machine's address>:0.0


I may have to CONSOLE you about your usage of ridiculously easy graphical interfaces...
Look ma, no mouse.

Offline

#8 2013-01-11 19:36:24

Painless
Member
Registered: 2006-02-06
Posts: 233

Re: X11 Forwarding with SSH not working [SOLVED]

Is there an entry for localhost in /etc/hosts?

Offline

#9 2013-01-11 22:14:09

gixr
Member
Registered: 2013-01-11
Posts: 5

Re: X11 Forwarding with SSH not working [SOLVED]

I can successfully send a client to Xming server using that exact command.

My /etc/hosts file is as follows:

#
# /etc/hosts: static lookup table for host names
#

#<ip-address>    <hostname.domain.org>    <hostname>
127.0.0.1    localhost.localdomain [computer name]
::1    localhost.localdomain     [computer name]

# End of file

Offline

#10 2013-01-11 22:18:00

Painless
Member
Registered: 2006-02-06
Posts: 233

Re: X11 Forwarding with SSH not working [SOLVED]

You require an entry for "localhost" as well as "localhost.localdomain" against 127.0.0.1

Offline

#11 2013-01-11 22:37:00

gixr
Member
Registered: 2013-01-11
Posts: 5

Re: X11 Forwarding with SSH not working [SOLVED]

That fixed it. Thank you very much, Painless.

Offline

#12 2013-01-12 16:27:56

Antoine
Member
From: Picton Ontario
Registered: 2012-10-11
Posts: 90

Re: X11 Forwarding with SSH not working [SOLVED]

gixr wrote:

That fixed it. Thank you very much, Painless.

I know it's solved and all, but I just want to say Thanks! as well. I wasn't even looking for that solution here, I just coincidentally had the exact same problem right now. I didn't see it as an Arch problem, though.

Gotta love Arch Linux!

Offline

#13 2013-06-19 16:36:24

ChristTrekker
Member
Registered: 2013-06-18
Posts: 7

Re: X11 Forwarding with SSH not working [SOLVED]

I'm having the same kind of problem, but I do have localhost defined in /etc/hosts and I cannot send a client to the Xming server.

Offline

#14 2013-06-20 00:11:57

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 7,132

Re: X11 Forwarding with SSH not working [SOLVED]

Since this is an old thread marked solved and since you don't have the same cause, I suggest starting a new thread and linking to this one. That is likely to attract more helpful viewers than adding to this one.


CLI Paste | How To Ask Questions

Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L

Offline

Board footer

Powered by FluxBB