HTB Academy - Footprinting Lab - Hard - id_rsa key/ssh connection

Hi ive tried looking through other forum posts relating to this lab and they have helped a little but still cant get into ssh.
Ive got the tom credentials from snmpwalk and I’m using the certificate given by the email services by using openssl.
when I try to use that certificate this is shown:
$sudo ssh tom@10.129.202.20 -i id_rsa
Load key “id_rsa”: invalid format
tom@10.129.202.20: Permission denied (publickey).
I’ve tried “sudo chmod 600 id_rsa”, yet still doesn’t work. do I have to dig further into the email services to find a different key? I’ve tried using commands on both imaps and pop3s but the commands given in the previous section don’t seem to work.
Please help!

It seems like you are experiencing issues with SSH and authentication using the provided certificate. Let’s try to troubleshoot the problem step by step:

  1. Ensure the private key file (id_rsa) is in the correct format: The error message “Load key ‘id_rsa’: invalid format” suggests that the key file might not be in the correct format. SSH keys are typically in the PEM format. If you received the key file from the email service, make sure it is saved as a PEM file. You can convert the key format using the following command:

    openssl rsa -in id_rsa -outform pem -out id_rsa.pem
    

    This command converts the key file (id_rsa) to PEM format and saves it as id_rsa.pem. Then try using id_rsa.pem in your SSH command instead of id_rsa.

  2. Check the file permissions: As you mentioned, you have already tried setting the file permissions to 600. Double-check the permissions of the private key file using the ls -l command:

    ls -l id_rsa.pem
    

    Ensure that the file is owned by your user and has the correct permissions (e.g., -rw-------).

  3. Confirm the correct username: Make sure that the username you are using (tom) is correct and corresponds to the account you are trying to access via SSH. If you obtained the credentials through SNMPwalk, it’s worth verifying the username associated with the provided credentials.

  4. Verify the IP address: Ensure that the IP address (10.129.202.20) is correct and corresponds to the destination host you are trying to connect to. Double-check the IP address for any typos or mistakes.

  5. Consider other authentication methods: If none of the above steps resolve the issue, it’s possible that the email service may provide additional keys or authentication methods. Review the email or any other documentation provided to see if there are any alternative authentication mechanisms mentioned.

By going through these troubleshooting steps, you should be able to identify and resolve the issue preventing you from accessing the SSH server.

Thanks after seeing your reply, ive tried step 1,2,3,4
this is what I get when I try it as a pem:
debug1: Trying private key: id_rsa.pem
Load key “id_rsa.pem”: invalid format
debug1: No more authentication methods to try.
tom@10.129.202.20: Permission denied (publickey).

but that command for converting it to a pem also does work so I renamed it to id_rsa.pem:
$ sudo openssl rsa -in id_rsa.pem -outform pem -out id_rsa.pem
unable to load Private Key
140629214983488:error:0909006C:PEM routines:get_name:no start line:…/crypto/pem/pem_lib.c:745:Expecting: ANY PRIVATE KEY

I’m not sure what other documentation there is that can help with the commands for the email services

don’t know if you figured this out… but i was having the same problem. it was the contents in the file that were incorrect for me.

i was off by one dash -
and i had some spaces to fix