X11 forwarding working only for some users

I can open X applications through ssh on a remote server for some users but not all.
( x11forwarding is set to yes in the configs )
Some users gives me the well known standard xauth error. e.g.

X11 connection rejected because of wrong authentication.
xterm: Xt error: Can’t open display: localhost:13.0

( using ssh -l $user -X $host )

I am a bit baffled why some users are not allowed remote X connections while others are.
Never had this problem before.

Where would such a distinction be made in the configs for particular users or does an X blacklist file exist for some users ?

All I know is I did not configure this server to block specific users.

Thanks

Pass the -v and see what it says. For example:

ssh -v -X user@server

Add more -v to increase debug level

ssh -vvv -X user@server

Check for X11Forwarding yes

Did you set X11Forwarding yes on server side inside the /etc/ssh/sshd_config file?

Check for xauth command

Is xauth command installed on both server and client?

Yes, as I stated in my original post forwarding is set to yes, else no account on the remote server will be allowed x-sessions. As Mentioned the curious issue is that some users are allowed to serve x-applications but some not.

xaurth is installed on both client and server and the result is identical as below on both machines.

$ whereis xauth
xauth: /usr/bin/xauth /usr/share/man/man1/xauth.1.gz

Here is the verbose output for a user account “remoteuser” on “remoteserver (IP=192.168.1.10)” where I ssh from testuser on client1 .

testuser@client1:~$ ssh -v -l remoteuser -X 192.168.1.10
OpenSSH_8.4p1 Debian-5+deb11u1, OpenSSL 1.1.1n  15 Mar 2022
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files
debug1: /etc/ssh/ssh_config line 21: Applying options for *
debug1: Connecting to 192.168.1.10 [192.168.1.10] port 22.
debug1: Connection established.
debug1: identity file /home/testuser/.ssh/id_rsa type -1
debug1: identity file /home/testuser/.ssh/id_rsa-cert type -1
debug1: identity file /home/testuser/.ssh/id_dsa type -1
debug1: identity file /home/testuser/.ssh/id_dsa-cert type -1
debug1: identity file /home/testuser/.ssh/id_ecdsa type -1
debug1: identity file /home/testuser/.ssh/id_ecdsa-cert type -1
debug1: identity file /home/testuser/.ssh/id_ecdsa_sk type -1
debug1: identity file /home/testuser/.ssh/id_ecdsa_sk-cert type -1
debug1: identity file /home/testuser/.ssh/id_ed25519 type -1
debug1: identity file /home/testuser/.ssh/id_ed25519-cert type -1
debug1: identity file /home/testuser/.ssh/id_ed25519_sk type -1
debug1: identity file /home/testuser/.ssh/id_ed25519_sk-cert type -1
debug1: identity file /home/testuser/.ssh/id_xmss type -1
debug1: identity file /home/testuser/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.4p1 Debian-5+deb11u1
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.6p1 Ubuntu-4ubuntu0.5
debug1: match: OpenSSH_7.6p1 Ubuntu-4ubuntu0.5 pat OpenSSH_7.0*,OpenSSH_7.1*,OpenSSH_7.2*,OpenSSH_7.3*,OpenSSH_7.4*,OpenSSH_7.5*,OpenSSH_7.6*,OpenSSH_7.7* compat 0x04000002
debug1: Authenticating to 192.168.1.10:22 as 'remoteuser'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:A/WYM3ftqFggR0BWHQQd7chEJ4YvtADTOFpu2qcYRT8
debug1: Host '192.168.1.10' is known and matches the ECDSA host key.
debug1: Found key in /home/testuser/.ssh/known_hosts:4
debug1: rekey out after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey in after 134217728 blocks
debug1: Will attempt key: /home/testuser/.ssh/id_rsa 
debug1: Will attempt key: /home/testuser/.ssh/id_dsa 
debug1: Will attempt key: /home/testuser/.ssh/id_ecdsa 
debug1: Will attempt key: /home/testuser/.ssh/id_ecdsa_sk 
debug1: Will attempt key: /home/testuser/.ssh/id_ed25519 
debug1: Will attempt key: /home/testuser/.ssh/id_ed25519_sk 
debug1: Will attempt key: /home/testuser/.ssh/id_xmss 
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Trying private key: /home/testuser/.ssh/id_rsa
debug1: Trying private key: /home/testuser/.ssh/id_dsa
debug1: Trying private key: /home/testuser/.ssh/id_ecdsa
debug1: Trying private key: /home/testuser/.ssh/id_ecdsa_sk
debug1: Trying private key: /home/testuser/.ssh/id_ed25519
debug1: Trying private key: /home/testuser/.ssh/id_ed25519_sk
debug1: Trying private key: /home/testuser/.ssh/id_xmss
debug1: Next authentication method: password
remoteuser@192.168.1.10's password: 
debug1: Authentication succeeded (password).
Authenticated to 192.168.1.10 ([192.168.1.10]:22).
debug1: channel 0: new [client-session]
debug1: Requesting no-more-sessions@openssh.com
debug1: Entering interactive session.
debug1: pledge: exec
debug1: client_input_global_request: rtype hostkeys-00@openssh.com want_reply 0
debug1: Requesting X11 forwarding with authentication spoofing.
debug1: Sending environment.
debug1: Sending env LANG = en_US.UTF-8
Welcome to Ubuntu 18.04.6 LTS (GNU/Linux 4.15.0-184-lowlatency i686)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

30 updates can be applied immediately.
To see these additional updates run: apt list --upgradable


4 updates could not be installed automatically. For more details,
see /var/log/unattended-upgrades/unattended-upgrades.log

Your current Hardware Enablement Stack (HWE) is going out of support
on 2023-04-30.  After this date security updates for critical parts (kernel
and graphics stack) of your system will no longer be available.

For more information, please see:
http://wiki.ubuntu.com/1604_HWE_EOL

There is a graphics stack installed on this system. An upgrade to a
configuration supported for the full lifetime of the LTS will become
available on 2020-07-21 and can be installed by running 'update-manager'
in the Dash.
    
*** /dev/sdb3 will be checked for errors at next reboot ***
*** /dev/sdb2 will be checked for errors at next reboot ***
*** /dev/sde14 will be checked for errors at next reboot ***
*** /dev/sde9 will be checked for errors at next reboot ***
*** /dev/sde8 will be checked for errors at next reboot ***

*** System restart required ***
Last login: Mon Sep 19 10:58:02 2022 from 10.0.10.249
remoteuser@remoteserver:~$ xterm
debug1: client_input_channel_open: ctype x11 rchan 3 win 65536 max 16384
debug1: client_request_x11: request from 127.0.0.1 37374
debug1: channel 1: new [x11]
debug1: confirm x11
X11 connection rejected because of wrong authentication.
debug1: channel 1: free: x11, nchannels 2
xterm: Xt error: Can't open display: localhost:15.0
remoteuser@remoteserver:~$

Try the following suggestions