This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: sshd, plink, bash and path problems

On Thu, 6 May 2004, Tim Shadel wrote:

> I'm not subscribed to the list.  Kindly CC: me in any threads that
> result from this email.  Thanks.
> [snip]
> What I found is this:
> (a) ssh localhost echo $PATH
> returned the correct cygwin path, but
> (b) ssh localhost 'echo $PATH'
> returned the full Windows path, not the cygwin path, and
> (c) ssh localhost "echo $PATH"
> returned the correct cygwin path as well.  But as I think about it, I
> actually can't change the quotes used around the command (since it's
> issued by a program over which I have no control).  What I CAN
> manipulate is the cygwin environment contacted by the ssh/plink program.
> >1. What's different between plink <host> <command> and plink <host>
> >(which displays a prompt) that causes the magical "login" process to
> >occur.  Is this a plink thing? a bash thing? a cygwin-version-of-either
> >thing?

It's a plink thing.  FWIW, ssh behaves similarly.

> Let me rephrase this a bit.  What happens differently between (a) and
> (b) above on the _server_ side?

Why not try it locally, like this:

echo echo $PATH
echo 'echo $PATH'
echo "echo $PATH"

and then

sh -xc 'PATH=/blah;echo $PATH'
sh -xc "PATH=/blah;echo $PATH"

> >2. Is there a file (.rc something-or-other perhaps?) that I can create
> >that will make the "source /etc/profile" call once plink connects, so I
> >can have the right path when <command> happens?

Well, you can tell ssh to invoke a login shell (e.g., "ssh a@b bash -l -c
'commands'").  I don't know about plink.

> Can I change the cygwin environment (server side) to handle both (a) and
> (b) in the same way?

No.  If you run the above experiments, you'll see why.

> I'm familiar with Linux, but Cygwin (and especially its interaction with
> Windows: environment, permissions, etc) is brand new to me.

This has nothing to do with Cygwin.  This is pure shell stuff.

> The quotation difference is step in the right direction (I know what to
> rule out), and I'm sure with a bit more info I'll be able solve my
> problem.  I appreciate your help.
> Thanks,
> Tim

      |\      _,,,---,,_
ZZZzz /,`.-'`'    -.  ;-;;,_
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski, Ph.D.
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

"I have since come to realize that being between your mentor and his route
to the bathroom is a major career booster."  -- Patrick Naughton

Unsubscribe info:
Problem reports:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]