Discussion:
x11 forwarding not working
(too old to reply)
William Unruh
2019-07-25 09:39:58 UTC
Permalink
I am having problems on some of my machines with X11 forwarding not
working. I get the error message when I log in with ssh
Warning: untrusted X11 forwarding setup failed: xauth key data not generated

This happens on the remote machines being both a Mga5 and a Mga7
machine. On the other hand, on another Mga6 machine I get no such
warning, and forwarding works. I cannot see the difference between the
three machines. That it works on some remote machines and not others
suggests it is some problem with the setu of those machines, not the
local machine. But I cannot see any differences between them.

Note that if I log into the Mga5 system from the working mga6 system,
x11 forwarding works.

Any hints as to where to look?
Bit Twister
2019-07-25 10:30:56 UTC
Permalink
Post by William Unruh
I am having problems on some of my machines with X11 forwarding not
working. I get the error message when I log in with ssh
Warning: untrusted X11 forwarding setup failed: xauth key data not generated
This happens on the remote machines being both a Mga5 and a Mga7
machine. On the other hand, on another Mga6 machine I get no such
warning, and forwarding works. I cannot see the difference between the
three machines. That it works on some remote machines and not others
suggests it is some problem with the setu of those machines, not the
local machine. But I cannot see any differences between them.
Note that if I log into the Mga5 system from the working mga6 system,
x11 forwarding works.
Any hints as to where to look?
First thing I would try is xhost.

A quick grep through my .bashrc shows I have
set_xhost +$(hostname --fqdn) > /dev/null 2>&1

Looking in my set_xhosts script, it checks to see if not already there,
add it.


_cnt=$(xhost | grep --count $1)
if [ $_cnt -eq 0 ] ; then
xhost +$1 > /dev/null 2>&1 &
fi

I also noticed any of my ssh scripts run the command prior to running ssh.
William Unruh
2019-07-25 12:44:16 UTC
Permalink
Post by Bit Twister
Post by William Unruh
I am having problems on some of my machines with X11 forwarding not
working. I get the error message when I log in with ssh
Warning: untrusted X11 forwarding setup failed: xauth key data not generated
This happens on the remote machines being both a Mga5 and a Mga7
machine. On the other hand, on another Mga6 machine I get no such
warning, and forwarding works. I cannot see the difference between the
three machines. That it works on some remote machines and not others
suggests it is some problem with the setu of those machines, not the
local machine. But I cannot see any differences between them.
Note that if I log into the Mga5 system from the working mga6 system,
x11 forwarding works.
Any hints as to where to look?
First thing I would try is xhost.
A quick grep through my .bashrc shows I have
set_xhost +$(hostname --fqdn) > /dev/null 2>&1
Looking in my set_xhosts script, it checks to see if not already there,
add it.
_cnt=$(xhost | grep --count $1)
if [ $_cnt -eq 0 ] ; then
xhost +$1 > /dev/null 2>&1 &
fi
I also noticed any of my ssh scripts run the command prior to running ssh.
If I run xhost on both the Mga6 ( which accepts x11 forwarding from my
laptop) and the Mga7 machine ( which does not accept x11 forwarding from
my laptop but does from the Mga6 machine) both have the same output of
xhost

access control enabled, only authorized clients can connect
INET:localhost
SI:localuser:unruh


So, no difference there.
Fenris
2019-07-25 13:36:58 UTC
Permalink
Post by William Unruh
Post by Bit Twister
Post by William Unruh
I am having problems on some of my machines with X11 forwarding not
working. I get the error message when I log in with ssh
Warning: untrusted X11 forwarding setup failed: xauth key data not generated
This happens on the remote machines being both a Mga5 and a Mga7
machine. On the other hand, on another Mga6 machine I get no such
warning, and forwarding works. I cannot see the difference between the
three machines. That it works on some remote machines and not others
suggests it is some problem with the setu of those machines, not the
local machine. But I cannot see any differences between them.
Note that if I log into the Mga5 system from the working mga6 system,
x11 forwarding works.
Any hints as to where to look?
First thing I would try is xhost.
A quick grep through my .bashrc shows I have
set_xhost +$(hostname --fqdn) > /dev/null 2>&1
Looking in my set_xhosts script, it checks to see if not already there,
add it.
_cnt=$(xhost | grep --count $1)
if [ $_cnt -eq 0 ] ; then
xhost +$1 > /dev/null 2>&1 &
fi
I also noticed any of my ssh scripts run the command prior to running ssh.
If I run xhost on both the Mga6 ( which accepts x11 forwarding from my
laptop) and the Mga7 machine ( which does not accept x11 forwarding from
my laptop but does from the Mga6 machine) both have the same output of
xhost
access control enabled, only authorized clients can connect
INET:localhost
SI:localuser:unruh
So, no difference there.
Just to make sure the problem is not xhost related, you want
to run 'xhost +' and see what happens.
HASM
2019-07-25 12:59:53 UTC
Permalink
Post by William Unruh
I am having problems on some of my machines with X11 forwarding not
working. I get the error message when I log in with ssh
Warning: untrusted X11 forwarding setup failed: xauth key data not generated
Assuming you've googled this and read through something like:

https://serverfault.com/questions/273847/what-does-warning-untrusted-x11-forwarding-setup-failed-xauth-key-data-not-ge

-- HASM
William Unruh
2019-07-25 20:16:39 UTC
Permalink
Post by HASM
Post by William Unruh
I am having problems on some of my machines with X11 forwarding not
working. I get the error message when I log in with ssh
Warning: untrusted X11 forwarding setup failed: xauth key data not generated
https://serverfault.com/questions/273847/what-does-warning-untrusted-x11-forwarding-setup-failed-xauth-key-data-not-ge
-- HASM
I am running Linux (Mageia) on all machines, not Apple OSX
Fenris
2019-07-25 20:36:59 UTC
Permalink
Post by William Unruh
Post by HASM
Post by William Unruh
I am having problems on some of my machines with X11 forwarding not
working. I get the error message when I log in with ssh
Warning: untrusted X11 forwarding setup failed: xauth key data not generated
https://serverfault.com/questions/273847/what-does-warning-untrusted-x11-forwarding-setup-failed-xauth-key-data-not-ge
-- HASM
I am running Linux (Mageia) on all machines, not Apple OSX
Once I had that problem, too.
I can't remember it corectly but I think it was xauth related. I think I had to
install xauth to make it work. Note, on some repositories its the "xorg-x11-xauth"
package.
Good luck!
William Unruh
2019-07-26 08:54:11 UTC
Permalink
Post by Fenris
Post by William Unruh
Post by HASM
Post by William Unruh
I am having problems on some of my machines with X11 forwarding not
working. I get the error message when I log in with ssh
Warning: untrusted X11 forwarding setup failed: xauth key data not generated
https://serverfault.com/questions/273847/what-does-warning-untrusted-x11-forwarding-setup-failed-xauth-key-data-not-ge
-- HASM
I am running Linux (Mageia) on all machines, not Apple OSX
Once I had that problem, too.
I can't remember it corectly but I think it was xauth related. I think I had to
install xauth to make it work. Note, on some repositories its the "xorg-x11-xauth"
package.
Good luck!
All three have xauth installed (as does the remote laptop)
HASM
2019-07-25 22:17:06 UTC
Permalink
Post by William Unruh
Post by HASM
https://serverfault.com/questions/273847/what-does-warning-untrusted-x11-forwarding-setup-failed-xauth-key-data-not-ge
I am running Linux (Mageia) on all machines, not Apple OSX
Forward with -Y instead of -X, and making sure xauth works, as
suggested in that post, should be OS independent things to check.
We're talking X11 and ssh ports that should work very similarly.

-- HASM
William Unruh
2019-07-26 09:17:18 UTC
Permalink
Post by HASM
Post by William Unruh
Post by HASM
https://serverfault.com/questions/273847/what-does-warning-untrusted-x11-forwarding-setup-failed-xauth-key-data-not-ge
I am running Linux (Mageia) on all machines, not Apple OSX
Forward with -Y instead of -X, and making sure xauth works, as
suggested in that post, should be OS independent things to check.
We're talking X11 and ssh ports that should work very similarly.
OK, that worked and it put me on the tack of the sulutions.

The problem was that the ForwardX11Trusted linein the sample ssh_config
file came after the Host lines which make me assume that was correct
order. It is not. I had put in some lines like
Host Mga7*
port 1234

entries since I am using non standard ssh ports. Apparently this meant
that the ForwardX11Trusted line applied to only the very last Host
entry. Moving the ForwardX11Trusted line before any of the Host lines
fixed the problem. Bug in Mageia/openssh sample ssh_config file.

Thanks to all who tried to help.
Bit Twister
2019-07-26 13:14:20 UTC
Permalink
Post by William Unruh
The problem was that the ForwardX11Trusted linein the sample ssh_config
file came after the Host lines which make me assume that was correct
order. It is not. I had put in some lines like
Host Mga7*
port 1234
entries since I am using non standard ssh ports. Apparently this meant
that the ForwardX11Trusted line applied to only the very last Host
entry. Moving the ForwardX11Trusted line before any of the Host lines
fixed the problem. Bug in Mageia/openssh sample ssh_config file.
Thanks to all who tried to help.
Now that you have made the fix, I am curious if there is a sshd reject
message in the journal and if so, what the message was logged.

Would you get a root terminal on the rejecting node and run
journalctl | grep -i ssh
and post the message, Please.
William Unruh
2019-07-26 16:39:27 UTC
Permalink
Post by Bit Twister
Post by William Unruh
The problem was that the ForwardX11Trusted linein the sample ssh_config
file came after the Host lines which make me assume that was correct
order. It is not. I had put in some lines like
Host Mga7*
port 1234
entries since I am using non standard ssh ports. Apparently this meant
that the ForwardX11Trusted line applied to only the very last Host
entry. Moving the ForwardX11Trusted line before any of the Host lines
fixed the problem. Bug in Mageia/openssh sample ssh_config file.
Thanks to all who tried to help.
Now that you have made the fix, I am curious if there is a sshd reject
message in the journal and if so, what the message was logged.
Would you get a root terminal on the rejecting node and run
journalctl | grep -i ssh
and post the message, Please.
Somehow I think you might get upset having a 200MB file posted here.

Besides there is nothing there that shows anything.

The ssh connection was not rejected. It was the forwarding that was
rejected.

But here is a sample from the time during which forwarding was not
accepted

Jul 23 12:34:44 t.s.c.a sshd[18873]: Accepted publickey for unruh from 95.xxx.xxx.xxx port 41852 ssh2: RSA SHA256:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Jul 23 12:34:44 t.s.c.a sshd[18873]: pam_unix(sshd:session): session opened for user unruh by (uid=0)

Not very helpful
Bit Twister
2019-07-26 17:12:58 UTC
Permalink
Post by William Unruh
The ssh connection was not rejected. It was the forwarding that was
rejected.
Yeah, but I was hoping for any useful message about forwarding.
Post by William Unruh
But here is a sample from the time during which forwarding was not
accepted
Jul 23 12:34:44 t.s.c.a sshd[18873]: Accepted publickey for unruh from 95.xxx.xxx.xxx port 41852 ssh2: RSA SHA256:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Jul 23 12:34:44 t.s.c.a sshd[18873]: pam_unix(sshd:session): session opened for user unruh by (uid=0)
Not very helpful
I agree.

David W. Hodgins
2019-07-25 13:37:03 UTC
Permalink
Post by William Unruh
I am having problems on some of my machines with X11 forwarding not
working. I get the error message when I log in with ssh
Warning: untrusted X11 forwarding setup failed: xauth key data not generated
Check the ssh settings. On the system you're connecting from
# grep -v ^'#' /etc/ssh/ssh_config|grep X11
ForwardX11 yes
ForwardX11Trusted yes

On the system you're connecting to ...
# grep -v ^'#' /etc/ssh/sshd_config|grep X11
X11Forwarding yes

Regards, Dave Hodgins
--
Change ***@nomail.afraid.org to ***@teksavvy.com for
email replies.
Fenris
2019-07-25 13:45:52 UTC
Permalink
Post by David W. Hodgins
Post by William Unruh
I am having problems on some of my machines with X11 forwarding not
working. I get the error message when I log in with ssh
Warning: untrusted X11 forwarding setup failed: xauth key data not generated
Check the ssh settings. On the system you're connecting from
# grep -v ^'#' /etc/ssh/ssh_config|grep X11
ForwardX11 yes
ForwardX11Trusted yes
On the system you're connecting to ...
# grep -v ^'#' /etc/ssh/sshd_config|grep X11
X11Forwarding yes
Regards, Dave Hodgins
Also also maybe /etc/hosts.allow and /etc/hosts.deny
William Unruh
2019-07-25 20:29:34 UTC
Permalink
Post by Fenris
Post by David W. Hodgins
Post by William Unruh
I am having problems on some of my machines with X11 forwarding not
working. I get the error message when I log in with ssh
Warning: untrusted X11 forwarding setup failed: xauth key data not generated
Check the ssh settings. On the system you're connecting from
# grep -v ^'#' /etc/ssh/ssh_config|grep X11
ForwardX11 yes
ForwardX11Trusted yes
On the system you're connecting to ...
# grep -v ^'#' /etc/ssh/sshd_config|grep X11
X11Forwarding yes
Regards, Dave Hodgins
Also also maybe /etc/hosts.allow and /etc/hosts.deny
ssh "works" -- ie connects. It just does not forward x11.
David W. Hodgins
2019-07-25 20:40:43 UTC
Permalink
Post by William Unruh
ssh "works" -- ie connects. It just does not forward x11.
On the machine you're connecting to, delete ~/.Xauthority then start
any X application such as kcalc. It should recreate the file and
hopefully work.

Regards, Dave Hodgins
--
Change ***@nomail.afraid.org to ***@teksavvy.com for
email replies.
Bit Twister
2019-07-26 01:33:16 UTC
Permalink
Post by William Unruh
ssh "works" -- ie connects. It just does not forward x11.
I would make sure all files are owned by user on both machines.
find $HOME \( -not -user $USER -or -not -group $USER \) -exec ls -al '{}' \;
and permission 600 on ~/.Xauthority
William Unruh
2019-07-25 20:27:20 UTC
Permalink
Post by David W. Hodgins
Post by William Unruh
I am having problems on some of my machines with X11 forwarding not
working. I get the error message when I log in with ssh
Warning: untrusted X11 forwarding setup failed: xauth key data not generated
Check the ssh settings. On the system you're connecting from
# grep -v ^'#' /etc/ssh/ssh_config|grep X11
ForwardX11 yes
ForwardX11Trusted yes
Yup
Post by David W. Hodgins
On the system you're connecting to ...
# grep -v ^'#' /etc/ssh/sshd_config|grep X11
X11Forwarding yes
Yup, on both machines (the working one and the non-working (warning
generated) one.
Post by David W. Hodgins
Regards, Dave Hodgins
J.O. Aho
2019-07-25 20:48:06 UTC
Permalink
Post by William Unruh
Post by David W. Hodgins
On the system you're connecting to ...
# grep -v ^'#' /etc/ssh/sshd_config|grep X11
X11Forwarding yes
Yup, on both machines (the working one and the non-working (warning
generated) one.
That configuration is for the remote machine, not the machine from where
you connect.

I would suggest you try out the -Y option for ssh, should work better
than -X.
--
//Aho
Continue reading on narkive:
Loading...