Public Key Cryptology
From Gruff Goat Wiki
What is Public Key Cryptography? From Wikipedia.
Contents |
Using OpenSSH
Create Keys
On the client computer:
- Change to your home directory
cd ~
- If it doesn't already exist, create a directory and set permissions
mkdir ~/.ssh chmod 700 ~/.ssh
- Generate a private/public key pair
ssh-keygen -b 2048 -t rsa -f ~/.ssh/id_rsa
- Enter a quality password when requested
- For automated sessions, use an empty password (remember this is a security risk)
- The ~/.ssh now has two new files, one named id_rsa and one named id_rsa.pub
- Now, distribute the public key anywhere that your identity needs to be verified.
Distribute Keys
On the host computer:
- Copy you public key from the client to the host.
- Change to your home directory
cd ~
- If it doesn't already exist, create a directory and set permissions
mkdir ~/.ssh chmod 700 ~/.ssh
- Append the public key to the authorized_keys file
cd ~/.ssh cat id_rsa.pub >> authorized_keys
The resulting authorized keys file should look something like this:
ssh-rsa NLGlkn0j-this-is-the-key-nlsdh9== user@clientname.tld ssh-rsa Glkn0j-this-is-another-key-nsd5h= user@anotherclient.tld . . .
Connect from Client to Host
Test the connection
ssh user@hostname.tld -i ~/.ssh/id_rsa
Enter the passphrase to open the private key when requested.