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: Issue with SCP and SSH on Windows 7


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


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