public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Issue with SCP and SSH on Windows 7
@ 2011-05-06 17:54 Metroshica
  2011-05-06 21:17 ` Jeremy Bopp
  0 siblings, 1 reply; 3+ messages in thread
From: Metroshica @ 2011-05-06 17:54 UTC (permalink / raw)
  To: cygwin


I have recently written a script in Windows Server Edition 2008 that SSHes
into a few linux servers, and then uses SCP to copy a file out of them. The
issue I'm having is with SSH keys getting set up, and cygwin trying to
create a .ssh directory in the C:/ directory, instead of where cygwin is
located. I'm running this program through the standard windows command
prompt, not cygwin's shell, as it is an automated process, and I don't know
how to automatically run a program in cygwin. Anyone know how I can change
the home directory to be C:/cygwin/home/user instead of the base C:/ dir, or
anyone know how to automatically run a script in cygwin? Thanks for the
help.
-- 
View this message in context: http://old.nabble.com/Issue-with-SCP-and-SSH-on-Windows-7-tp31561012p31561012.html
Sent from the Cygwin list mailing list archive at Nabble.com.


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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Issue with SCP and SSH on Windows 7
  2011-05-06 17:54 Issue with SCP and SSH on Windows 7 Metroshica
@ 2011-05-06 21:17 ` Jeremy Bopp
  2011-05-06 22:17   ` Metroshica
  0 siblings, 1 reply; 3+ messages in thread
From: Jeremy Bopp @ 2011-05-06 21:17 UTC (permalink / raw)
  To: cygwin

On 5/6/2011 12:54, Metroshica wrote:
> 
> I have recently written a script in Windows Server Edition 2008 that SSHes
> into a few linux servers, and then uses SCP to copy a file out of them. The
> issue I'm having is with SSH keys getting set up, and cygwin trying to
> create a .ssh directory in the C:/ directory, instead of where cygwin is
> located.

Check to make sure that you don't have the HOME environment variable
configured to C:.  If it is, you need to remove it just in case, but you
may try adding it back once you get things working.  Next, you need to
check that the user account used to run scp has an entry in the
/etc/passwd file within the Cygwin installation:

grep ^the_user: /etc/passwd

That won't output anything if the_user does not have an entry in that
file.  Otherwise, you'll see the record for the_user.  If you see such a
record, take a look at the path that appears between the last and second
to last colons in the line.  That path is the home directory that Cygwin
programs such as the SSH tools will use.  Set it to a Cygwin-style path
that points to the proper location.

If the grep command doesn't output anything, you can add an appropriate
entry by running the following from the bash shell:

mkpasswd -u the_user -d >>/etc/passwd

If the account is *not* a domain account, use this instead:

mkpasswd -u the_user -l >>/etc/passwd

These changes should correct the issue by allowing the SSH family of
programs to correctly find the user's home directory as configured under
Cygwin.

> I'm running this program through the standard windows command
> prompt, not cygwin's shell, as it is an automated process, and I don't know
> how to automatically run a program in cygwin. Anyone know how I can change
> the home directory to be C:/cygwin/home/user instead of the base C:/ dir, or
> anyone know how to automatically run a script in cygwin? Thanks for the
> help.

You should be fine with running things directly from Windows programs,
including the command prompt, unless you need extra environment settings
provided by Cygwin to login shells.  Since you're otherwise running
things successfully apparently, don't worry about changing this part.

-Jeremy

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Issue with SCP and SSH on Windows 7
  2011-05-06 21:17 ` Jeremy Bopp
@ 2011-05-06 22:17   ` Metroshica
  0 siblings, 0 replies; 3+ messages in thread
From: Metroshica @ 2011-05-06 22:17 UTC (permalink / raw)
  To: cygwin


Jeremy, I don't know who you are, but I don't feel uncomfortable saying I
love you. Thank you so much for the help, cleared the issue right up.


Jeremy Bopp-3 wrote:
> 
> On 5/6/2011 12:54, Metroshica wrote:
>> 
>> I have recently written a script in Windows Server Edition 2008 that
>> SSHes
>> into a few linux servers, and then uses SCP to copy a file out of them.
>> The
>> issue I'm having is with SSH keys getting set up, and cygwin trying to
>> create a .ssh directory in the C:/ directory, instead of where cygwin is
>> located.
> 
> Check to make sure that you don't have the HOME environment variable
> configured to C:.  If it is, you need to remove it just in case, but you
> may try adding it back once you get things working.  Next, you need to
> check that the user account used to run scp has an entry in the
> /etc/passwd file within the Cygwin installation:
> 
> grep ^the_user: /etc/passwd
> 
> That won't output anything if the_user does not have an entry in that
> file.  Otherwise, you'll see the record for the_user.  If you see such a
> record, take a look at the path that appears between the last and second
> to last colons in the line.  That path is the home directory that Cygwin
> programs such as the SSH tools will use.  Set it to a Cygwin-style path
> that points to the proper location.
> 
> If the grep command doesn't output anything, you can add an appropriate
> entry by running the following from the bash shell:
> 
> mkpasswd -u the_user -d >>/etc/passwd
> 
> If the account is *not* a domain account, use this instead:
> 
> mkpasswd -u the_user -l >>/etc/passwd
> 
> These changes should correct the issue by allowing the SSH family of
> programs to correctly find the user's home directory as configured under
> Cygwin.
> 
>> I'm running this program through the standard windows command
>> prompt, not cygwin's shell, as it is an automated process, and I don't
>> know
>> how to automatically run a program in cygwin. Anyone know how I can
>> change
>> the home directory to be C:/cygwin/home/user instead of the base C:/ dir,
>> or
>> anyone know how to automatically run a script in cygwin? Thanks for the
>> help.
> 
> You should be fine with running things directly from Windows programs,
> including the command prompt, unless you need extra environment settings
> provided by Cygwin to login shells.  Since you're otherwise running
> things successfully apparently, don't worry about changing this part.
> 
> -Jeremy
> 
> --
> Problem reports:       http://cygwin.com/problems.html
> FAQ:                   http://cygwin.com/faq/
> Documentation:         http://cygwin.com/docs.html
> Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/Issue-with-SCP-and-SSH-on-Windows-7-tp31561012p31562709.html
Sent from the Cygwin list mailing list archive at Nabble.com.


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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-05-06 22:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-06 17:54 Issue with SCP and SSH on Windows 7 Metroshica
2011-05-06 21:17 ` Jeremy Bopp
2011-05-06 22:17   ` Metroshica

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).