I’ve got this private key… but why can’t I SSH?

In the challenge, players were given an id_rsa file, however, they were unable to SSH into the server using that.

Firstly, I tried to SSH into the server by using the given private key:

sudo ssh -p 30321 user@challenge.ctf.games -i id_rsa

However, the server responded with the following error:

Load key 'id_rsa': error in libcrypto

Upon doing a bit of research, I landed upon a StackOverflow post which suggested that the error was due to a new line character at the end of the private key file.

To fix this, I simply removed the new line character from the end of the private key file by using nano text editor.

I then tried to SSH into the server again and it worked! All I had to do was cat the flag.txt file in the spawn directory to get the flag.