SSH with X11 forwarding after su

You can SSH to a server with X11 forwarding to allow you to run X11 (graphical) applications on the server and have them show up on your local machine.

ssh -X [the user]@[the server]

However, if you then run su to log in as a different user, you'll probably receive the following error when you run an X11 application:

X11 connection rejected because of wrong authentication.
X I/O error

Prevent this error by exporting, after su, the authority you gave the initial user to run X11 applications:

export XAUTHORITY=/home/[the user]/.Xauthority


Last modified: 24/09/2008 Tags: (none)

This website is a personal resource. Nothing here is guaranteed correct or complete, so use at your own risk and try not to delete the Internet. -Stephan

Site Info

Privacy policy

Go to top