SSH Notes
SSH Notes
SSH Notes
1. Private Key:
o The private key is kept on the user's local machine and must be kept
secret. It is used to decrypt messages that were encrypted with the
corresponding public key. If someone gains access to your private key,
they could impersonate you.
2. Public Key:
o Use a tool like ssh-keygen to generate an SSH key pair. This command
creates both the private and public keys.
ssh-keygen -t rsa -b 2048 -f ~/.ssh/id_rsa
2. Key Storage:
3. Key Exchange:
o When connecting to an SSH server, your client sends the public key to
the server during the authentication process.
Example: The public key might be added to the authorized_keys file on the
server.
4. Authentication:
o The server checks if the received public key matches any private key
stored on the server. If there is a match, the user is authenticated and
granted access.
Example: When connecting to a server, your private key is used to prove that
you possess the corresponding public key.
5. Passphrase:
o For additional security, you can add a passphrase to your private key.
This passphrase acts as a second layer of protection.
Example: When accessing your private key, you need to provide the
passphrase.
SSH Key Pair Usage Examples:
1. SSH Connection:
Then, paste it into the SSH key settings on the respective platform.
By using SSH key pairs, you can securely authenticate and communicate with remote
servers or services without the need for passwords, enhancing both security and
convenience in various scenarios.