scp copy directory to another server with private key auth

user2693017 picture user2693017 · Dec 11, 2013 · Viewed 99.7k times · Source

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 ?

Answer

Abhishek Goel picture Abhishek Goel · Sep 7, 2016

or you can also do ( for pem file )

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