SUMMARY: X11 Forwarding with OpenSSH

From: Carlos Sevillano <>
Date: Tue Apr 13 2004 - 13:10:48 EDT
Thanks to those who replied.  I seem to understand the nature of
the problem and are working to implement the scripts and

Susan Hanna" <
Pavic, Aleksander" <

>From Susan:
X Applications from Another User-id

>From Alek:
The Problem: 
When you login you get an $DISPLAY of "localhost:10.0" or
something like that. 
This is an identifier for a specific ssh tunnel. 
If you do a 'su - user' then you also change the enviroment var
$DISPLAY. You have to set it to the old value, or you cannot
connect to your local x-server.

The next Problem is the X-Auth-Cookie. If you change your user
(with enviroment [su - user]) your default x-Auth will change!

There a two ways to fix this Problem: 

1.) Anytime you change a user, do it WITHOUT enviroment!!!! This
will save your original $DISPLAY and X-AUTH-Cookie. 
2.) If you need to change the enviroment to the new user then
write a script (place the code in .bash_profile/.profile/.kshrc)
that print you origin $DISPLAY var into a file.

Also copy your origin x-AUTH. After 'su -' or something simillar
wrap your new $DISPLAY to the old one which is saved in the
file. (try this first, if it doesn't work - continue).

- Temporary copy your origin X-Auth-Cookie to the one of the new
user. DON'T FORGET TO SAVE THE ORIGIN! And copy the origin back
on logout.

Original Posting was:
Users unable to do X11 forwarding once the switch to another
user via PPAK, su, or sudo.

Get your own "800" number
Voicemail, fax, email, and a lot more
sunmanagers mailing list
Received on Tue Apr 13 13:10:44 2004

This archive was generated by hypermail 2.1.8 : Thu Mar 03 2016 - 06:43:31 EST