CentOS Distro - I created a custom private/public key pair in the home directory using ssh-keygen -f .custom_location/custom_key. Then I tried copying the public key to a test VM using only the remote VM's IP which has only two regular users (user1 and user2). How does ssh pick one user over another when prompting me for password for copying the public key? I confirmed that .ssh folder was created in only the user1. If I had three users, would it still prompt user1's password when copying the public key?
When I try to ssh into test VM using ssh -i .custom_location/custom_key username@ipaddress, why does it require private key? I thought public key is presented when connecting. Where is public key being used in the process?
I am confused as to who is the client and who is the server. Is the computer attempting the connection the client? and thus will have the known_hosts file?