Use su with ssh X-forwarding
This is a shameless ripoff of Howto use su with ssh x-forwarding [coderwall.com] If you ssh to a server and want to do X forwarding, make sure the server allows it in /etc/ssh/sshd_config:
X11Forwarding yes
And then your ssh command should include -X, or make sure your ~/.ssh/config includes:
ForwardX11 yes
Command:
ssh -X servername
And once on the server, prepare your xauth file to be shared the other user before switching and merging it.
xauth extract /tmp/x $DISPLAY chmod 0644 /tmp/x su otherusername xauth merge /tmp/x
updated 2020-11-17
Make sure that xauth is installed on your system!
Comments