# Fail to SSH into host OS

**URL:** <https://forums.balena.io/t/fail-to-ssh-into-host-os/48162>\
**Category:** balenaOS\
**Created:** [December 2, 2019, 8:41pm UTC](https://forums.balena.io/t/fail-to-ssh-into-host-os/48162 "2019-12-02T20:41:44Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![lpierrat](https://avatars.discourse-cdn.com/v4/letter/l/edb3f5/32.png) [@lpierrat](https://forums.balena.io/u/lpierrat)\
**Post date:** [December 2, 2019, 8:41pm UTC](https://forums.balena.io/t/fail-to-ssh-into-host-os/48162/1 "2019-12-02T20:41:44Z")

</div>

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:

```auto
$ 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](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

---

<div class="post-metadata">

**Author:** ![jimsynz](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/jimsynz/32/4663_2.png) [@jimsynz](https://forums.balena.io/u/jimsynz)\
**Post date:** [December 2, 2019, 8:59pm UTC](https://forums.balena.io/t/fail-to-ssh-into-host-os/48162/3 "2019-12-02T20:59:43Z")

</div>

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](https://github.com/balena-os/meta-balena#sshkeys)

---

<div class="post-metadata">

**Author:** ![lpierrat](https://avatars.discourse-cdn.com/v4/letter/l/edb3f5/32.png) [@lpierrat](https://forums.balena.io/u/lpierrat)\
**Post date:** [December 2, 2019, 9:03pm UTC](https://forums.balena.io/t/fail-to-ssh-into-host-os/48162/5 "2019-12-02T21:03:09Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![jimsynz](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/jimsynz/32/4663_2.png) [@jimsynz](https://forums.balena.io/u/jimsynz)\
**Post date:** [December 2, 2019, 9:10pm UTC](https://forums.balena.io/t/fail-to-ssh-into-host-os/48162/6 "2019-12-02T21:10:29Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![lpierrat](https://avatars.discourse-cdn.com/v4/letter/l/edb3f5/32.png) [@lpierrat](https://forums.balena.io/u/lpierrat)\
**Post date:** [December 2, 2019, 9:15pm UTC](https://forums.balena.io/t/fail-to-ssh-into-host-os/48162/7 "2019-12-02T21:15:07Z")

</div>

Thanks a lot for the quick answer!

---

<div class="post-metadata">

**Author:** ![jimsynz](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/jimsynz/32/4663_2.png) [@jimsynz](https://forums.balena.io/u/jimsynz)\
**Post date:** [December 2, 2019, 9:24pm UTC](https://forums.balena.io/t/fail-to-ssh-into-host-os/48162/8 "2019-12-02T21:24:52Z")

</div>

My pleasure.
