9

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?

Theoden
  • 297
  • 1
  • 2
  • 11

3 Answers3

12

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.

Rodrigo Murillo
  • 13,080
  • 2
  • 29
  • 50
4

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
2

FWIW, I was using a destination syntax of username@ipaddr:/dir and got this error. I had to use username@hostname:/dir. Surprised I had to specify the hostname...

kenyee
  • 2,309
  • 1
  • 24
  • 32