SSH - Server keeps asking for password

Even after correctly generating SSH keys and ssh-copy-id them to the remote server, connectivity problems may still arise when attempting to connect using the public key. An issue I frequently encounter is when a multiple key files exist within the ~/.ssh directory, causing the SSH client to select the incorrect one for server connection. This can be identified by activating the verbose option while running the SSH client: ssh -v <user>@<server>.

To fix this issue, modify the ~/.ssh/config file to explicitly tell the SSH client to use a designated key file for connecting to the specific remote server:

Host <IP address here>
    Hostname <IP address here>
    IdentityFile ~/.ssh/myserver/id_rsa