How to use scp command without the -i option and still find the priv key

0

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?

Perplexed

Posted 2013-06-05T17:34:50.090

Reputation: 1

Are you doing this from the Windows command line or from a cygwin shell? – terdon – 2013-06-05T19:14:23.540

Answers

0

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... https://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.

Costa

Posted 2013-06-05T17:34:50.090

Reputation: 491

0

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.

Perplexed

Posted 2013-06-05T17:34:50.090

Reputation: 1