user2693017
user2693017

Reputation: 1870

scp copy directory to another server with private key auth

is there something wrong with this scp command ?

scp -C -i ./remoteServerKey.ppk -r /var/www/* [email protected]:/var/www

I use the same .ppk as in putty and enter the same passphrase, but it asks me 3 times and than says connection denied. I thought I used it before and it worked, but it isn´t atm. If it is wrong, how should I do it ?

Upvotes: 58

Views: 170349

Answers (4)

Abhishek Goel
Abhishek Goel

Reputation: 19771

or you can also do ( for pem file )

 scp -r -i file.pem [email protected]:/home/backup /home/user/Desktop/

Upvotes: 61

Lokesh
Lokesh

Reputation: 671

Covert .ppk to id_rsa using tool PuttyGen, (http://mydailyfindingsit.blogspot.in/2015/08/create-keys-for-your-linux-machine.html) and

scp -C -i ./id_rsa -r /var/www/* [email protected]:/var/www

it should work !

Upvotes: 36

Borja Tarraso
Borja Tarraso

Reputation: 883

The command looks quite fine. Could you try to run -v (verbose mode) and then we can figure out what it is wrong on the authentication?

Also as mention in the other answer, maybe could be this issue - that you need to convert the keys (answered already here): How to convert SSH keypairs generated using PuttyGen(Windows) into key-pairs used by ssh-agent and KeyChain(Linux) OR http://winscp.net/eng/docs/ui_puttygen (depending what you need)

Upvotes: 2

abasterfield
abasterfield

Reputation: 2282

Putty doesn't use openssh key files - there is a utility in putty suite to convert them.

edit: it is called puttygen

Upvotes: 10

Related Questions