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
    Commented Apr 3, 2018 at 11:55

4 Answers 4

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
    Commented 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"? Commented Oct 23, 2018 at 20:22
  • yes. That is exactly what I mean.
    – JannieT
    Commented 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? Commented 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
    Commented 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) Commented 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
0

This happened to me because, I've entered a passphrase while creating the key file,

That's why trying to connect via terminal it prompts for the passphrase, and after entering it we will be able to access the terminal,

But while using the same for filezila using "key file" as logon type it shouldn't asks for the password, it directly expects the private key, but due to the restriction by our passphrase filezila can't get that, that's why it says "could not be loaded or does not contain a private key"

So, we have to choose "Interactive" as a login type in filezila.

1
  • 1
    As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.
    – Community Bot
    Commented Jun 8 at 13:22

You must log in to answer this question.

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