SSH private key authentication not working in Ubuntu server
I tried turning off password authentication and allowing only key authentication, but it didn't work either.
If key authentication doesn't work, then it doesn't work independently from other authentication types. They don't interfere with each other.
(Without having the public key on the server's authorized_keys file)
It's not going to work that way. Literally anyone can generate their own id_rsa keypair – having the public key on the server's authorized_keys file is how the server actually knows that it's your key rather than someone else's.