Fail to SSH into host OS

Hi,

I would like to SSH into Host OS on my Balena device.
But when I do balena ssh <device-ip> or just ssh root@<device-ip> I have a permission denied issue:

$ balena ssh 192.168.0.129
root@192.168.0.129: Permission denied (publickey).

Whereas if I do balena ssh <device uuid> -s it works correctly.

I’ve installed openssh container in a multicontainers project but I still have this error. (https://github.com/balena-io-playground/balena-openssh)

I’m using a production version of Balena. I tried to add my public key into authorized_keys file but the file doesn’t save the change…

I could use the uuid to SSH, but the device will be offline, so that’s why I need to access via the IP.

How can I do that?

Thanks

Hi,

You can add additional ssh keys to your device by placing them in the config.json file as per the meta-balena documentation[1].
If you’re running a Raspberry Pi then it might be easiest just to pop out the SD card and modify the file on your PC (the resin-boot volume), otherwise you can use balena ssh <device-id> while the device is online and modify the file directly in /mnt/boot (be careful while editing this file - JSON is very picky that the file is correctly formatted!) and then reboot the devices.

Thanks,
James.

1: https://github.com/balena-os/meta-balena#sshkeys

Thanks.

And can you confirm that if the device is offline the service will continue to run? I mean the device doesn’t need access to balenacloud?

Hi,

Yes, your containers will stay running as normal and you will be able to SSH into the device while it is disconnected from balenaCloud.

Thanks,
James.

Thanks a lot for the quick answer!

My pleasure.