# Exporting env vars to other xterms



## sim (Nov 11, 2009)

Hi

I'm trying to set-up ssh-agent which involves setting up some environment vars, but I've encountered a problem.

If I 'export foo="bar"' in a KDE Konsole, $foo is not made available in any other Konsoles, new or existing. Which means that when I run ssh-agent, which sets various vars, I can only use it in the original Konsole session (or laboriously redefine the vars in each new Konsole by hand).

I've googled but can't find a reference to the problem, let alone a solution!

Seems so simple - Any ideas?

sim


----------



## SirDice (Nov 11, 2009)

Edit .cshrc or .profile depending on your shell.


----------



## aragon (Nov 12, 2009)

You need to go about this another way.  Environment vars can only be exported to _child_ processes.  You need to export those vars higher up in the process chain, eg. before your window manager starts.

What I do is let ssh-agent start my WM.  In my ~/.xsession:


```
ssh-agent xfce4-session
```


----------



## sim (Nov 14, 2009)

aragon said:
			
		

> You need to go about this another way.  Environment vars can only be exported to _child_ processes.  You need to export those vars higher up in the process chain, eg. before your window manager starts.
> 
> What I do is let ssh-agent start my WM.  In my ~/.xsession:
> 
> ...



Your suggestion put me on the right track - I ended up using this solution: http://mah.everybody.org/docs/ssh-agent-startup (see last section).

Thanks!

sim


----------

