1

So I started to use ssh on a server and I noticed that there are two ways of authenticating. I can either just type ssh@username and then provide password or I can use -i command and then select a key file that I have on my drive to give as an argument?

I though the key was necessary to encrypt the communication. If the key file is not provided what is the key used to encrypt the communication?

1 Answer 1

6

The users key is used for authentication of the user only, similar to the optional client certificate in TLS (which includes HTTPS). Encryption is done with a key created using a key exchange algorithm like Diffie-Hellman but only after authorizing the server to protect against man in the middle attacks. Insofar is SSH similar to TLS.
For more information have a look at Understanding the SSH Encryption and Connection Process.

1
  • @SteffenUlrich Thanks, I will read the link to understand better
    – yoyo_fun
    Commented Dec 22, 2016 at 19:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .