[lug] auto set DISPLAY variable from ssh login?

Sean Reifschneider jafo at tummy.com
Mon Sep 25 16:10:19 MDT 2006

On Sun, Sep 24, 2006 at 08:10:15PM +0000, D. Stimits wrote:
>Does anyone know if there is a way to automate setting of DISPLAY based 
>on the remote IP of an ssh text login? And better yet, to do so only for 
>certain IP addresses?

I used to do this, depending on what IP I logged in from.  In some cases it
would get confused when I went from one machine to another, but mostly it

However, more recently, I rarely run X programs on another system.  SSH X
forwarding works great for that though, as other folks mention.

Other options are to set up AllowEnv and then export an environment
variable on the client.  That can even go through multiple SSH hops.  You
could also use the "command=" stuff in your authorized_keys file to set up
environment variables depending on what key you are using.  Then just have
different keys on the different machines you are using.

 The Roman Rule: The one who says it cannot be done should never
 interrupt the one who is doing it.
Sean Reifschneider, Member of Technical Staff <jafo at tummy.com>
tummy.com, ltd. - Linux Consulting since 1995: Ask me about High Availability

More information about the LUG mailing list