AdSense

Friday, September 1, 2017

9 - Linux Security: generating a pair of SSH keys (public/private)


GENERATING A PAIR OF SSH KEYS (PUBLIC/PRIVATE)

- Layout for this exercise:




- Public key cryptography or asymmetrical cryptography is a cryptographic system that uses a pair of keys.

- Public keys may be disseminated widely, and private keys are known only to the owner. 

- This accomplishes two functions: authentication, which is when the public key is used to verify that a holder of the paired private key sent the message, and encryption, whereby only the holder of the paired private key can decrypt the message encrypted with the public key:

https://en.wikipedia.org/wiki/Public-key_cryptography

- Generating a pair of keys (private and public) according to the RSA asymmetric cryptographic algorithm. Notice that a passphrase is optionally asked for:

https://en.wikipedia.org/wiki/RSA_(cryptosystem)




- The two keys are stored into the folder .ssh:




- The private key:




- The public key:




- Checking the IP:
















- Copying the  public key so that locally available keys are used to authorize logins on remote machines:




- Trying the SSH connection:




- The passphrase is required to unlock the private key:





- Entering the passphrase (without password !!) the SSH connection is successful:




- Let's see that the public key was actually added:




- The authorized key matches the public key (id_rsa)obtained previously:




- Connecting from other server: