54

is there something wrong with this scp command ?

scp -C -i ./remoteServerKey.ppk -r /var/www/* root@192.168.0.15:/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 ?

user2693017
  • 1,750
  • 6
  • 24
  • 50

4 Answers4

56

or you can also do ( for pem file )

 scp -r -i file.pem user@192.10.10.10:/home/backup /home/user/Desktop/
Abhishek Goel
  • 18,785
  • 11
  • 87
  • 65
35

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/* root@192.168.0.15:/var/www

it should work !

steampowered
  • 11,809
  • 12
  • 78
  • 98
Lokesh
  • 661
  • 6
  • 9
  • Converting to openssh key from ppk and then using your command asked me for passphrase. Any idea why? Cause of that I'm unable to connect and copy. – Mital Pritmani Sep 08 '15 at 14:22
  • http://thanosk.net/content/conver-putty-ppk-key-ssh-key This link created a key that worked for me without any issue. Thanks for the command though. – Mital Pritmani Sep 09 '15 at 15:28
10

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

edit: it is called puttygen

abasterfield
  • 2,214
  • 12
  • 17
2

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)

Community
  • 1
  • 1
Borja Tarraso
  • 863
  • 2
  • 12
  • 20