WinSCP "Server refused our key", Putty is working

0

I just set up a new EC2 machine with amazon-linux-2023 on it. 2. I cloned the connection in WinSCP from a previous server, as it uses the same security group & keys. Username is ec2-user. 3. When I try to connect via SFTP, I get the error message "Server refused our key". 4. When I then select "Open in PuTTY" from the Login dropdown, the connection is established without any problems, so I have configuered the correct key. 5. I then went through the instructions on https://docs.aws.amazon.com/transfer/latest/userguide/transfer-file.html#winscp but no joy.

asked a year ago825 views
1 Answer
2
Accepted Answer

Hello

WinSCP has a great session-logging function. This will give you more detailed information on the "Server refused our key" error. You can enable this in the logging section in WinSCP preferences -> https://winscp.net/eng/docs/ui_pref_logging

Hope this helps you to find the underlying cause of this issue.

profile picture
Bisina
answered a year ago
  • Thank you, this allowe me to fix the issue! The log had the following line in it: "No supported authentication methods available (server sent: publickey,gssapi-keyex,gssapi-with-mic)"

    I could research that and the reason for the problem is that newer Amazon Linx version no longer accepts the old key algorithm when using SFTP https://winscp.net/forum/viewtopic.php?t=32146

    So, I generated a new key pair using the algorithm ed25519 and then followed these instructions to add the key to the server: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/replacing-key-pair.html

    To retrieve the public key for pasting into the .ssh/authorized_keys file on the server, you can use WinSCP too: Edit the session -> Advanced -> SSH -> Authentication. Select the new private key file there and then hit the button "Display Public Key"

  • Welcome, glad to hear that this worked.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions