1

My SSH key(s) refuses to work on my new KDE neon install. I tried reinstalling the keys and finally found the problem in debug mode. The key file is not used because it has a custom name. This is surprising because it worked fine on Ubuntu 18.04 in the past years, but on the new KDE neon it has this bug.

The procedure is the usual (already worked on Ubuntu 18.04)

-generate key pair on admin side ssh-keygen -b 4096 (I assign a custom name to differentiate servers)

-add the new key to the server ssh-copy-id -i ~/.ssh/custom_name.pub user@192.168.x.x

Everything is fine, no errors, key is confirmed in ~/.ssh/authorized_keys on the server side

The problem seems to be that ssh does not try the custom name key when connecting:

debug1: Trying private key: /home/gerge/.ssh/id_rsa
debug1: Trying private key: /home/gerge/.ssh/id_ecdsa
debug1: Trying private key: /home/gerge/.ssh/id_ecdsa_sk
debug1: Trying private key: /home/gerge/.ssh/id_ed25519
debug1: Trying private key: /home/gerge/.ssh/id_ed25519_sk
debug1: Trying private key: /home/gerge/.ssh/id_xmss
debug1: Trying private key: /home/gerge/.ssh/id_dsa

If the key is called id_rsa then it works, but I need custom names because there are many keys. Any idea?

local admin system: KDE neon Linux HOSTNAME 5.15.0-56-generic #62-Ubuntu SMP Tue Nov 22 19:54:14 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

Gerge
  • 35
  • 5

1 Answers1

2

This is not a bug.

You did not specify -i ~/.ssh/custom_name in your ssh(1) command, so it is using the defaults:

-i identity_file

Selects a file from which the identity (private key) for public key authentication is read. You can also specify a public key file to use the corresponding private key that is loaded in ssh-agent(1) when the private key file is not present locally. The default is ~/.ssh/id_rsa, ~/.ssh/id_ecdsa, ~/.ssh/id_ecdsa_sk, ~/.ssh/id_ed25519, ~/.ssh/id_ed25519_sk and ~/.ssh/id_dsa.

You could also add this to your .ssh/config, e.g.,

Host 192.168.x.x
  User user
  IdentityFile ~/.ssh/custom_name
Esa Jokinen
  • 46,944
  • 3
  • 83
  • 129
  • thanks, I did not know about `~/.ssh/config` file, but it is very nice and solved my issue – Gerge Jan 12 '23 at 17:58
  • This does not answer the question completely. Why is the `-i` flag not required in Ubuntu or Ubuntu based distributions (like linux mint) but required everywhere else? What does Ubuntu do differently? – SayantanRC Aug 01 '23 at 15:22
  • @SayantanRC: What do you mean by that? It has a default value, and is required for paths other than the defaults regardless the distribution. – Esa Jokinen Aug 02 '23 at 04:51