[WBEL-users] ssh environment question

Kirby C. Bohling kbohling@birddog.com
Tue, 21 Sep 2004 22:05:08 -0500


On Tue, Sep 21, 2004 at 09:57:10PM -0400, Whitebox wrote:
> yes, they are .bash_profile. I assume this is not actually executed 
> unless I actually login whereas .bashrc is executed when my shell is 
> called. Is this correct?
> 

.bash_profile is run everything you start a login shell (the shell
is invoked with "-l" is a good rule of thumb, I'm not sure if
"login" actually does anything different).

Your .bashrc is run everytime a non-login interactive shell is
started (according the the bash man page).  However, every
.bash_profile I know of source .bashrc.  Just read the man page
search for .bash_profile and/or .bashrc

There's a section of the sshd man page that pretty well describes
the situation.  It's got a list of 9 steps, by concise summary is
this:

Setup a minimal environment, based on the compile time options. Read
the file ~/.ssh/environment (if that's allowed by the config), then
run the scripts either ~/.ssh/rc or /etc/ssh/sshrc, finally the last
step is to either run your shell or your command.  So your shell is
never getting run, your command is just being run without giving you
a login shell is my guess.

This command:
ssh server '/bin/bash --login -c "export"'

	Should give you what you are looking for.  It gives you what you
are looking for.  I've had similar problems and had to track this,
and cron down before.

	Kirby



> 
> Jesse wrote:
> 
> >On Tue, 21 Sep 2004, Whitebox wrote:
> >
> > 
> >
> >>This should be an easy question for somebody. When I ssh into a box that
> >>has custom bash environment ( full login ) and do an 'export' I get say
> >>50 environment variables. but when I execute from another host ' ssh
> >>server export', I only get a small subset of my custom shell environment
> >>variables.
> >>
> >>Does anyone know how to change this? I would like to 'ssh server export'
> >>and get all of my environment variables. Is it a flag in ssh that I 
> >>missed?
> >>   
> >>
> >
> >One possible reason is that your custom environment variables are set in
> >your .profile or .login (or /etc/profile, /etc/profile.d, or
> >/etc/csh.login). Those are only executed when you actually login.
> >
> >You move those variables to your .bashrc or .cshrc.
> >
> >---
> >Jesse <j@lumiere.net>
> >
> >
> > 
> >
> 
> _______________________________________________
> Whitebox-users mailing list
> Whitebox-users@beau.org
> http://beau.org/mailman/listinfo/whitebox-users
>