Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

temwa's avatar
Level 1

SSH Login Not Working

When I try to ssh into my server as below

ssh [email protected] -i ~/.ssh/id_rsa.pub (Not the atual IP address)

I get the error below

ssh_exchange_identification: Connection closed by remote host

I contacted support on Laravel Forge and have been advised to use the private key. How do I do that? I am only familiar with using the public key.

0 likes
6 replies
mushood's avatar
mushood
Best Answer
Level 41

You have two keys:

id_rsa.pub --> public key

id_rsa --> private key

when connecting to the server, you need to use your private key

so you ssh command would look like this:

ssh [email protected] -i ~/.ssh/id_rsa

just remove the .pub at the end

Do you have the private key?

temwa's avatar
Level 1

Hi @mushood

Thanks. Yes, I have the private key. I have tried it but the connection is just timing out.

mushood's avatar

Make sure that the key is enabled for connection on the server Also make sure that bash access is enabled on the server

For the command the structure is usually like this

ssh -i path/to/privatekey [email protected]

temwa's avatar
Level 1

I have the public key enabled in Laravel Forge. I don't know where or if I am also suppoed to enable the private key.

I think bash access is enabled on the server because I was able to connect before.

The problem started when there was a process on the server that just spiked all of a sudden to 100% or near 100%.

mushood's avatar

@temwa I think the best bet is to talk to forge assistance. They are usually responsive.

temwa's avatar
Level 1

@mushood , Thank you. I have contacted them and got several responses. Thanks for your help.

Please or to participate in this conversation.