Troubles with balena ssh <UUID> connect

Hi everyone. I Have a problem with access by ssh to balena devices. I use balena_cli
something happens with ssh public key.
I have 2 ssh key:

alex@alex-VirtualBox:~$ balena keys
ID     NAME
315569 GitHub Key 1
315183 linux_laptop_VBox

alex@alex-VirtualBox:~$ balena key 315183
ID:   315183
NAME: linux_laptop_VBox
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDAJsOA5OG***kz88= alex@alex-VirtualBox

lex@alex-VirtualBox:~$ balena key 315569
ID:   315569
NAME: GitHub Key 1
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDAJsOA5OG***kz88=

They are almost similar but added different ways. One from GIThub, second with hands.
I successfully logged to balena:

alex@alex-VirtualBox:~$ balena login -w
 _            _
| |__   __ _ | |  ____  _ __    __ _
| '_ \ / _` || | / __ \| '_ \  / _` |
| |_) | (_) || ||  ___/| | | || (_) |
|_.__/ \__,_||_| \____/|_| |_| \__,_|

Logging in to balena-cloud.com
Opening web browser for URL:
https://dashboard.balena-cloud.com/login/cli/http%253A%*******7103%252Fauth
Successfully logged in as: g_a****y_t***v
Find out about the available commands by running:
  $ balena help
For further help or support, visit:
https://www.balena.io/docs/reference/balena-cli/#support-faq-and-troubleshooting

I have device:

alex@alex-VirtualBox:~$ balena device 64450453
== SRINIVAS QA HRDC INDIA
ID:                    7882212
DEVICE TYPE:           intel-nuc
STATUS:                idle
IS ONLINE:             true
IP ADDRESS:            100.67
PUBLIC ADDRESS:        44.20
MAC ADDRESS:           60:6D:
FLEET:                 clayton_
LAST SEEN:             2022-10-1
UUID:                  64450453
COMMIT:                fa832d194deb
SUPERVISOR VERSION:    14.0.8
IS WEB ACCESSIBLE:     false
OS VERSION:            balenaOS 2022.7.0
DASHBOARD URL:         https://dashboard.balena-cloud.com/devices/6445
CPU USAGE PERCENT:     78
CPU TEMP C:            44
MEMORY USAGE MB:       517
MEMORY TOTAL MB:       7828
MEMORY USAGE PERCENT:  7
STORAGE BLOCK DEVICE:  /dev/nvme0n1p6
STORAGE USAGE MB:      811
STORAGE TOTAL MB:      118520
STORAGE USAGE PERCENT: 1
alex@alex-VirtualBox:~$ 

Lets try to connect to this device:

alex@alex-VirtualBox:~$ balena ssh 64450453*** --debug
[debug] new argv=[/home/alex/balena_soft/balena-cli-v14.3.1-linux-x64-standalone/balena-cli/balena,/snapshot/versioned-source/bin/balena,ssh,64450453***] length=4
[debug] Deprecation check: 5.14330 days since last npm registry query for next major version release date.
[debug] Will not query the registry again until at least 7 days have passed.
[Debug]   Trying to fetch device by UUID 64450453*** (string)
[Debug]   Executing [/usr/bin/ssh,-t,-p,22,-o,LogLevel=ERROR,-o,StrictHostKeyChecking=no,-o,UserKnownHostsFile=/dev/null,g_alexey_titov@ssh.balena-devices.com,host 64450453***]
g_alexey_titov@ssh.balena-devices.com: Permission denied (publickey).
SSH: Remote command "host 64450453***" exited with non-zero status code "255"

Are the SSH keys correctly configured in balenaCloud? See:
https://www.balena.io/docs/learn/manage/ssh-access/#add-an-ssh-key-to-balenacloud
Are you accidentally using `sudo`?

RemoteCommandError: SSH: Remote command "host 64450453" exited with non-zero status code "255"

Are the SSH keys correctly configured in balenaCloud? See:
https://www.balena.io/docs/learn/manage/ssh-access/#add-an-ssh-key-to-balenacloud
Are you accidentally using `sudo`?
    at runRemoteCommand (/snapshot/versioned-source/build/utils/ssh.js:98:15)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async SshCmd.run (/snapshot/versioned-source/build/commands/ssh.js:82:9)
    at async SshCmd._run (/snapshot/versioned-source/node_modules/@oclif/command/lib/command.js:43:20)
    at async Config.runCommand (/snapshot/versioned-source/node_modules/@oclif/config/lib/config.js:175:24)
    at async CustomMain.run (/snapshot/versioned-source/node_modules/@oclif/command/lib/main.js:27:9)
    at async CustomMain._run (/snapshot/versioned-source/node_modules/@oclif/command/lib/command.js:43:20)
    at async /snapshot/versioned-source/build/app.js:76:13
    at async Promise.all (index 2)
    at async oclifRun (/snapshot/versioned-source/build/app.js:94:5)

What I did wrong?
How I can check SSH access with exist keys? I meant something like that:

lex@alex-VirtualBox:~$ ssh -T git@github.com
Hi Alex**** You've successfully authenticated, but GitHub does not provide shell access.

For resolve this issue you need generate an elliptic curve based ed25519 key as this Github Guide shows:

This is necessary as recent operating systems like Fedora and Alpine have dropped RSA key authentication for host keys. This affects the way how our balenaCloud verifies the SSH key for your given user to login to the device.

1 Like