Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I can't transfer files using pscp to amazon AWS ec2 instances. Key refused

I can connect to the server command line using Putty using the same private key.

But when I try to use the same key to transfer a file from my PC over to the server":

pscp -i C:\xxx.ppk "C:\xx\somefile.yy" ec2-xx-xx-xxx-xxx.compute-1.amazonaws.com:/home/(some location)

I receive the following error:

Server refused our key Fatal: Disconnected: No supported authentication methods available (server sent: publickey)

Could someone help me with fixing this problem please?

like image 840
Theoden Avatar asked Jan 07 '16 21:01

Theoden


2 Answers

You may want to review the Error: Server refused our key or No supported authentication methods available section of the Troubleshooting Connecting to Your Instance document.

Try this: add the -l user name option to the pscp command line, with the proper username for your instance.

pscp -i C:\xxx.ppk -l user ec2-user "C:\xx\somefile.yy" ec2-xx-xx-xxx-xxx.compute-1.amazonaws.com:/home/(some location)

The -l option allows you to connect with specified username. You may have a username mismatch.

like image 90
Rodrigo Murillo Avatar answered Sep 23 '22 02:09

Rodrigo Murillo


btw guys none of the examples above didn't work for me and here is what I use:

  1. With putty I converted .pem file into .ppk: Conversions->importkey->save private key (now we have .ppk)
  2. pscp -scp -i c:/ssh-key/ssh.ppk ./dist/* ubuntu@ec2-***.us-west-2.compute.amazonaws.com:/home/ubuntu/www
like image 39
Konstantin Malikov Avatar answered Sep 21 '22 02:09

Konstantin Malikov