Unable to log in my server without password

After following the usual steps (a search for ssh login no password will give plenty of tutorials) I was still unable to login to my second server (which runs ubuntu 22.04).

At first I thought the problem was that RSA was deprecated. So I switched to ecdsa

ssh-keygen -t ecdsa

That did not allow me to login either.

However, when I debugged the login in with:

ssh user@server.com -vv

I noticed that ssh was looking for id_ecdsa in ~/.ssh for the private key. So I copied the file with the private key to id_ecdsa and was able to login subsequently.

I was under the impression that the file with the private key on the local computer could have any name. Perhaps that assumption was wrong.