First of all what I want to do:
I want to login to a server via ssh
. Then change change the user via sudo su user
and start some application on my screen.
Some collegues do it by
su user
export DISPLAY=<IP>:0
an it works.
I connect to a server via ssh -X user@server
. Then I start a X11 application. This works fine (although there are warnings).
Warnings:
libEGL warning: DRI3: failed to query the version
libEGL warning: DRI2: failed to authenticate
qt.qpa.xcb: QXcbConnection: XCB error: 1 (BadRequest), sequence: 414, resource id: 1897, major code: 155 (Unknown), minor code: 1
If I run sudo su
(or sudo su user
) and start the program or run it via sudo myprogram
there is an error.
Error:
X11 connection rejected because of wrong authentication.
qt.qpa.xcb: could not connect to display localhost:11.0
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, xcb.
Aborted
I found some articles about this problem.
X11 forwarding fails when switching users
ssh connection. X11 connection rejected because of wrong authentication
So extend the /etc/pam.d/su
file and the /etc/pam/sudo
file by
session optional pam_xauth.so
And later I changed /etc/ssh/sshd_config
by adding:
X11Forwarding yes
and restarting the sshd by systemctl restart ssh.service
. ssh -T
says x11forwarding yes
But nothing changed.
Does anybody know what to do? Its important to check some changes on the users program configurations after making changes.
su user2
, you cannot do a secondssh -X user2@server
in a different terminal window?