sshd, plink, bash and path problems

Tim Shadel timshadel@pobox.com
Thu May 6 18:01:00 GMT 2004


I'm not subscribed to the list.  Kindly CC: me in any threads that result from this email.  Thanks.


Larry Hall wrote:

> Sorry, I don't use putty or plink (and actually since they aren't part 
> ofthe Cygwin distribution, much discussion of them is off-topic for 
> this list).

Understood.  I'll try rephrase my original question in terms of ssh.

> But I expect your problem isn't putty/plink specific but rather 
> operator-error. I can reproduce the same "problem" you're reporting 
> with 'ssh' (which is part of the Cygwin distribution). I believe you want:
>
>plink -batch -2 -i C:\path\to\my\key\mykey.PPK -l tims 159.87.127.66 'echo $PATH'
>  
>
Hmm.  I tried to replicate this with 'ssh' as well, after you mentioned 
it.  Here's what I did:

1.  Use Putty to connect to the cygwin machine via SSH.
2.  Use 'ssh-keygen' to create a key on the cygwin machine, and add it 
to the authorized_keys file.
3.  Use 'ssh-agent' and 'ssh-add' to hold my key in memory so it can be 
used without a prompt
4.  Use 'ssh localhost <command>' to simulate the 'plink' setup I 
described earlier

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?
>  
>
Let me rephrase this a bit.  What happens differently between (a) and 
(b) above on the _server_ side?

>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?
>  
>
Can I change the cygwin environment (server side) to handle both (a) and 
(b) in the same way?  I'm familiar with Linux, but Cygwin (and 
especially its interaction with Windows: environment, permissions, etc) 
is brand new to me.

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


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list