I am unable to SSH into my terminal

Type: Bitnami Support Tool

Description:
SSH doesn’t work when I try to connect both through the console & SFTP.

I am using a WordPress Application hosted on AWS LightSail.
The problem started when the keys I originally used were not working and I tried generating keys as the Bitnami docs suggests here. I tried doing everything but it actually locked me out of the SSH Terminal through the web. Closing this instance and starting a new one would be very time-consuming & I was wondering if anyone has suggestions on how I can gain access back to the terminal.

Hi @aarongkebede,

Thanks for your message. Please note that guide is for virtual machines, and not for cloud images, although it should work. However you need to download the created private key to your local machine to be able to connect into it using the key. If you don’t have the private key, I’m afraid you can’t use it. However, I wonder what happened to your previous key. Did you remove it from the authorized_keys file or did you modify any other setting? Do you get any error message with the SSH-in-browser console?

1 Like

Hi @gongomgra, thank you for your response.
I downloaded the key to my local machine & I was not able to connect to my instance using it.
I did not remove my previous key from the authorized_keys file, but I believe the file got rewritten when I followed the guide.
I did not get an error message while I was logged into the console, but the next time I tried logging in, I got an error.

Hi @aarongkebede,

Thanks for your message. I see in our guide we are proposing to use the next command for transferring the public key to the authorized_keys file

cat id_rsa.pub >> /home/bitnami/.ssh/authorized_keys

The >> part of the command means “append the content on the left to the file on the right”, therefore your authorized_keys file should keep having the old public key as well. Can you share with us the error messages you get trying to SSH now?

Can you also check with AWS support team about the issues using the SSH-in-browser feature?

1 Like

Hi,
This is the error I get:

Hi @aarongkebede,

Thanks for the info. I did a quick search in the AWS forums, and I think the next thread is reporting a similar issue than the one you have

https://forums.aws.amazon.com/thread.jspa?threadID=307027

However, you don’t seem to have SSH access using the terminal. Can you share with us the error message you are getting using the terminal? How are you providing the SSH private key file?

1 Like

@gongomgra, thank you for your message, as always.
I am providing the local keys I used to use as usual. Instead of PuttY, I am using FileZilla to connect with SFTP. I am getting the following error:

Hi @aarongkebede,

Thanks for your message. Is default.cer the name of the SSH private key you downloaded? It is weird, usually private keys use the .pem extension. Can you check it? Also, if you restarted the server, it is possible that the public IP address have changed, can you check it as well?

Can you also ask the AWS support team for help on recovering your access? I’m afraid I don’t know if they can do anything to help you with that. Can you send us the logs from PuTTY? Setting the debug mode may be of help I think

1 Like

Hi @gongomgra, thanks for your response!
Yes, I was surprised when I saw the .cer extension as well. But, that’s what was downloaded. I have attached a static IP to my instance, so the IP wouldn’t change with server restarts.
Thanks for your help!
I should probably close this thread.

Hi @aarongkebede,

Thanks for your message and the information provided. Unfortunately, I think there isn’t anything else we can help you to check. Just to give it another try, can you run the next command and share the output with us?

ssh -i PATH_TO_YOUR_SSH_KEY -vv bitnami@YOUR_IP_ADDRESS

Please replace the PATH_TO_YOUR_SSH_KEY and YOUR_IP_ADDRESS placeholders

Hi @gongomgra, much thanks for responding to my questions.
This is the error I have got:

I have decided to move into a different instance. I am slowly and carefully backing up everything and moving. I don’t think there is any feasible solution easier than moving instances.
Thanks for your help!

Hi @aarongkebede,

I think moving to a different instance is the easier path. After seeing the output you shared, and just to give it a last try, can you run the next command to better protect your private key as suggested in the debug log? You need to run it from the folder where the private key is located, or provide the chmod command below with the path to the key.

chmod 600 default.cer

After that, try to login again using the key

Hi @gongomgra,

I’ve tried doing that as well; no luck.
Thanks for the help!

Hi @aarongkebede,

Thanks for your message. I’m sorry we couldn’t help you to fix your issue. We hope you don’t get more issues like that in the future with your new instance!

Please let us know if we can close this thread or if you have any other questions related to this.

Regards,
Gonzalo

1 Like

Hi @gongomgra!
Feel free to close the thread & thanks for all the tech tips!

Hi @aarongkebede,

Thanks for your message and your kind words. I’m closing the thread now.

Regards,
Gonzalo