there.
In this question, I have a very specific one about public and private keys. So Public keys should be put on the opposite side. For example, if we have a server, the public key of the server should be put in the user's machine And the user's machine public key should be put into the server machine this is the theory that is telling the example with the example of Alice and Bob. they want to transfer a file within each other But my question starts here I saw many, many websites for setting up SSH via a public key and private keys (including ssh.com, windows website, raspberry pi documentation(as my server)). But I didn't see any Source that says, put the ssh public key of the server to the user's machine.
So we know the server has the user's public key so that when the server wants to send data over the SSH tunnel, it will encrypt it using the public key and the user will decrypt it using the private key. But how a user can encrypt this data to send it to the server without having the server's public key ?? I didn't see anywhere to set up this one I did the steps of mentioned trustable sites to set up SSH key authentication and it worked for me, but I cannot understand how this two-way connection is established without having the server public key. Is that true that it will transfer in the background with the first connection initially or without having the server's public key the users can receive and encrypt data from the server?
I know that was a little long question, but the idea behind this is simple, and I think something is not true here or something is misunderstood by me. So I will appreciate if you help me to solve this.