amazon-ec2puttyprivate-keypscp

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?


Solution

  • 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.