Cant log in due to Permission Denied

ssh -p 22222 root@ 
root@ Permission denied (publickey).

Even though I have checked twice that my public key is registered in Balena cloud, which is how I deployed the app.

Is there an additional step I am missing?

Hi, @pitosalas,
to use balena CLI, you need to login to your balenaCloud account as described here:
Could you please follow these steps and let us know how it worked for you?

Please note above I am not using balena cli.

Is the device in local mode ?
Does it work with balena ssh work ?

There are two ssh public keys in the cloud, one for each of my computers. Does that cause a potential problem?

Because balena ssh also doesnโ€™t work but I am sure it has worked before. I get a slightly longer error message.

balena ssh

   โ”‚                                                                    โ”‚
   โ”‚                  Update available 12.7.7 โ†’ 12.9.1                  โ”‚
   โ”‚                                                                    โ”‚
   โ”‚   โ”‚
   โ”‚                                                                    โ”‚

root@ Permission denied (publickey).
Warning: ssh process exited with non-zero code "255"

Are the SSH keys correctly configured in balenaCloud? See:

And, no, itโ€™s not in local mode.


It could be that your SSH public key is out of date. You can check that what you have on your workstation matches whatโ€™s in balenaCloud preferences. Something like cat ~/.ssh/ and then compare that with the key in balena. If you have two keys, you may have to explicitly add the proper identity to your ssh command, such as ssh -i ~/.ssh/id_rsa -p 22222 root@<ip-adddress>.



Did you happen to disable/enable VPN on any of these devices? Weโ€™re looking into this as perhaps related to your ssh issue.


Not knowingly or on purpose.

Pito Salas
Brandeis Computer Science
Volen 134

Hi Pito,
I think there is a misunderstanding here.
You are accessing your device directly via ssh. For that to work the device must either have a development version of Balena installed or you must add your public key to the device. The keys stored in balena-cloud are for accessing devices via balena-cli.
Does balena ssh <device-uuid> work for you ? If yes your keys are OK.
To register your key on the device and be able to use ssh you need to add the key to the devices config.json (in /mnt/boot/config.json) as explained here . Please be very careful when editing config.json - a broken config.json will prevent your device from coming online and starting balena properly. I strongly suggest making a copy of the file and testing your edits with jq before rebooting the device. cat /mnt/boot/config.json | jq should display no errors if your edit was correctโ€ฆ
Regards Thomas

1 Like

Thanks for the great answer. I understand now.