502: Bad Gateway SSH& Web Terminal

On opening terminal I get this message.
What can be wrong.
Please advise

i have this problem too… Tried connecting with putty too and it is refused…

Fixed it… In the plug in page there is a tab called CONFIGURATION, select it and you will see the default setup

username: hassio
password: ‘’
authorized_keys: []

Put a hard password in between single talking marks and then save it. It wont start if the password is too simple or has been cracked before…


Had to use a hard password in SSH terminal configuration

1 Like

Hi everyone, I’m getting the same error.
I have a strong password and I’m using also an authorized key!!
Is possible the problem is because I’m running Supervised HA in an RPi?

Edit: I tried to install the other SSH plugin and it worked but I prefer this one :stuck_out_tongue:

Thanks, that solved my problem

worked for me too Thanks!!

I am using HA Supervised installation. I am getting same issue. I used hard password but not working. But able to use other ssh add-on. Write me if any solution. Thanks

I had the same problem on a supervised installation on a Linux host. The solution for me was to change the default port for SSH on the Linux part.

I had to change /etc/ssh/sshd_config file on Linux, I changed the Port key from the default port number (22) to some other free port (in my case 8022) and restarted the sshd service with:
systemctl restart sshd.service

Keep in mind that once the change is made, if you want to connect to the host with ssh you have to specify the port.

1 Like

Good hint!.

I changed port on addon’s configuration page, not the host’s ssh port.


I had the same issue. I had entered a strong password but hadn’t noticed the Save button. Now it works as it should.

I ran into the same issue.

Sometimes it take a minute for the SSH to get ready. See the logs tab to ensure that the ssh is up and running. the log tab is to the right of configuration tab.

You can also access logs directly with (e.g. http://homeassistant.local:xxxx/hassio/addon/a0d7b954_ssh/info)

Yet. Hard password worked for me. Thanks!

Also, once you set your password, your existing session giving a bad gateway won’t work

Just reopen the shell once you’ve set a hard password.

1 Like

Your method worked for me.

Thank you so much !

I am also having this problem. I try to enter a password in between the double quotes and hit save. I go to the log tab and it tells me it isn’t configured. Go back to the configuration tab and everything is default again. I have uninstalled and reinstalled it. Restarted home assistant in between and I can’t get this to work.

That worked indeed, thank you!

Is it possbile to use scp ? I get :

$ scp custom_components.zip hassio@homeassistant:
root@homeassistant's password: 
subsystem request failed on channel 0
scp: Connection closed

SSH works, SCP not, also not when enabling SFTP.
I tried to mod sshd_config and can login with root too now, but not SCP. any ideas?
I am running HA OS so found no other way to get files on - media upload fails too.

Nice ! It works !!!

3 years later and still the GOAT thank you!