2

While trying to connect to AWS instance using SFTP, it gives me an error while setting the ~/.ssh/id_rsa.pub file for connection.

Error - Could not load key file. File 'id_rsa.pub' could not be loaded or does not contain a private key. - File Zilla

1
  • And what is the error?
    – Toto
    Apr 3, 2018 at 11:55

3 Answers 3

4

Realized that it needed a private file (key) to be given for setting up SFTP connection. ~/.ssh/id_rsa is the private file ~/.ssh/id_rsa.pub is the public file One has to use the private file for FileZilla to connect.

6
  • I have an active ~/.ssh/id_rsa private key file that I use to ssh into my server, but I get this same error message when I try to set this in FileZilla. Any idea what the problem is?
    – JannieT
    Oct 23, 2018 at 13:37
  • Do you mean it says "Could not load key file. File 'id_rsa' could not be loaded or does not contain a private key. - File Zilla"? Oct 23, 2018 at 20:22
  • yes. That is exactly what I mean.
    – JannieT
    Oct 24, 2018 at 9:45
  • This is very weird coz id_rsa is the private key file and only possible explanation is that it might be corrupt for some reason. Can you try downloading the pem file or creating a new pem file and using that? Oct 24, 2018 at 23:29
  • Not so. If my private id-rsa file was corrupt then I would not be able to use it many times every day to ssh into several servers. But heh, I'm just reporting what I am experiencing, not trying to explain the problem. If someone has a similar problem as me, then try my answer below.
    – JannieT
    Oct 25, 2018 at 8:38
0

On MacOS FileZilla wouldn't accept my active private key stored at ~/.ssh/id_rsa, but when I set the Logon Type to Interactive I could connect without a password.

1
  • I use MacOS and FileZilla does accept private key. More importantly, to connect to AWS you ideally should need a pem file (from security standpoint) Oct 24, 2018 at 23:27
0

While this is a bit old and the accepted answer is somewhat correct, it still doesn't solve the issue. However, it will work fine if you use the absolute path.

/users/username/.ssh/id_rsa

Some background to the story, while using ~/.ssh/id_rsa it still returns the same error even though the file exists, as I use it to connect via the terminal.

Could not be loaded or does not contain a private key.
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .