Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am logged into a win2008 box, I run scp with the -i option that points to the directory where the private key resides on the win2008 box.

scp -i "cygdrive/c/users/userid/privkey..." user@linux:/dirA/dirB/* .

When I run this command on the win2008 box it logs into the Linux box, matches the keys and sends the files over to the win2008 box. If I don't specify the key, it prompts me for a password.

I generated the keys on the win2008 box using ssh-keygen. I added the Linux key in the winsshd setup under public keys. Then I took the key from the ssh-keygen and put it on the Linux box.

Where is the scp command looking for the key? How can I run scp from the win2008 box without passing the key as a parameter?

share|improve this question
    
Are you doing this from the Windows command line or from a cygwin shell? –  terdon Jun 5 '13 at 19:14

2 Answers 2

If I understand your question correctly, there are a couple of options...

  1. set the the default identity file location the same way it's done for SSH, as explained here... http://stackoverflow.com/questions/84096/setting-the-default-ssh-key-location

  2. or alias your scp command to include the modifier like so... alias scp='scp -i /path/of/keyfile'

They both should work, but I recommend option 1 over option 2. It's the more correct way to do it.

share|improve this answer

I think I found my own answer. Apparently scp is looking for the private key file to be named id_dsa AND it wants the file in the .ssh directory. Once I found home/.ssh in the cygwin directory structure (another key piece to the puzzle) and added the private key file with the name id_dsa and ran the scp command without the -i option it worked. Thanks everyone for sending 'smart' vibes my way so I could get this figured out. Not perplexed anymore! I like all the suggestions made here. Appreciate the quick feedback.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.