How it works?
Client knocks at the servers door. Server sends public key.
Client checks if he knows the public key according to ˜/.ssh/known_host and if not it can be added by manual confirmation –> the server becomes accepted.
Client and server negotiate based on the ‘Deffie-Hellman-Algorithm’ an session key, that is shared equally and used for encryption & decryption.
Client sends and ID for a key pair (public/private). Server generates a random number, encrypts it with the public key and sends it to the client.
Client decrypts the number with the private key, calculates an MD5 hash and sends it to the server. The server compares the MD5 hash with and own calculated MD5 hash based on the original random number and identifies the client.
SSH without entering a password
Generate a public key with 8192 bit and use no password (just type enter):
ssh-keygen -b 8192
Upload the public key to the server:
ssh-copy-id -i ~/.ssh/id_rsa.pub user@server
Test the connection:
ssh 'user@server'