Question: how ssh connection is established?
Answer: The way SSH works is by making use of a client-server model to allow for authentication of two remote systems and encryption of the data that passes between them. ... It organizes the secure connection by authenticating the client and opening the correct shell environment if the verification is successful.