uncloud icon indicating copy to clipboard operation
uncloud copied to clipboard

[BUG] SSH private key not found

Open alperchoco opened this issue 2 months ago • 3 comments

I run the basic example and get this:

❯ uc machine init kali@orb
Error: SSH login to remote machine kali@orb: read private key file "/Users/alper/.ssh/id_ed25519": open /Users/alper/.ssh/id_ed25519: no such file or directory

That is true because my key is called .ssh/alper.pub

Is this hardcoded somewhere?

alperchoco avatar Nov 05 '25 16:11 alperchoco

This is the default key path used if you don't specify any. From the uc machine init --help:

  -i, --ssh-key string        Path to SSH private key for remote login (if not already added to SSH agent). (default "~/.ssh/id_ed25519")

You can specify it explicitly with uc machine init kali@orb -i ~/.ssh/alper.pub. Although it seems alper.pub is the public key, you need to specify the path to your private SSH key (identity).

Alternatively, add your ssh key to the local SSH agent with ssh-add path/to/key so you don't need to specify it for machine init/add commands.

psviderski avatar Nov 06 '25 04:11 psviderski

I'm hitting this error and specifying the key isn't working.

The key is in my agent, it gets me into my host, and my host has passwordless sudo enabled. I also tried root@ but got the same results.

$ uc machine init -c homelab-spfy [email protected]
Error: SSH login to remote machine [email protected]: read private key file "/home/spiffytech/.ssh/id_ed25519": open /home/spiffytech/.ssh/id_ed25519: no such file or directory

$ uc machine init -c homelab-spfy [email protected] -i ~/.ssh/id_spiffytech
Error: SSH login to remote machine [email protected]: parse private key: ssh: this private key is passphrase protected

$ ssh-keygen -lf ~/.ssh/id_spiffytech
3072 SHA256:B8hLj7cVhtdAGY5ZQeIt119QHZNeqQ0275dsctsr4VI spiffytech@spiffytop (RSA)

$ ssh-add -l | grep sr4VI
3072 SHA256:B8hLj7cVhtdAGY5ZQeIt119QHZNeqQ0275dsctsr4VI spiffytech@spiffytop (RSA)

$ ssh [email protected]
Linux homelab-spfy-1 6.12.43+deb13-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.12.43-1 (2025-08-27) x86_64
Last login: Sat Nov  8 10:16:47 2025 from 192.168.122.1
spiffytech@homelab-spfy-1:~$ sudo ls
spiffytech@homelab-spfy-1:~$

~/.ssh/config

Host 192.168.122.156
  ProxyJump 192.168.2.149
  Port 2223

uc version 0.13.2 Local: Fedora 42 Remote: Debian 13 Trixie

spiffytech avatar Nov 08 '25 15:11 spiffytech

@spiffytech as you likely already discovered, the SSH configuration (.ssh/config) is not supported at the moment and will be supported after finishing the implementation of ssh+cli:// targets: https://github.com/psviderski/uncloud/pull/173, https://github.com/psviderski/uncloud/pull/152. We're planning to make this the default in the future releases.

psviderski avatar Nov 10 '25 02:11 psviderski