How to make X applications run on local workstations after ssh -X then su -

From K12LTSP Wiki

Jump to: navigation, search

If you use ssh -X to connect to the servers you might have difficulty runing applications as other users. The following is how to make X applications work after using SSH to connect to the remote server and then using su to run applications as a different user.

This link was via Google at http://wiki.bic.mni.mcgill.ca/index.php/X11AuthError

Contents

Information gathering

Log into the remote server

[kmatson@mydesk]$ ssh -X root@someserver.somedomain
[root@ltspserver]#

Determine the hostname

[root@ltspserver]# hostname
hatteras

Determine the DISPLAY environment variable

[root@ltspserver]# echo $DISPLAY
localhost:10.0

Determine the xauthkey

[root@ltspserver]# xauth list || grep hatteras/unix:10
hatteras/unix:10  MIT-MAGIC-COOKIE-1  reallylonghexadecimalnumber

Target user environment adjustment

Su to target user

[root@ltspserver]# su - someuser
[someuser@ltspserver]$

Add the xauthkey to environment

If you have mouse support I strongly recommend you copy and paste the xauthkey into the following command.

[someuser@ltspserver]$ xauth add hatteras/unix:10  MIT-MAGIC-COOKIE-1  reallylonghexadecimalnumber
[someuser@ltspserver]$   <--- no visible result

You should now be able to run any X application as the target user and have it display on your local workstation.

Personal tools