Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • From a terminal, generate the SSH key pair.

    Code Block
    ssh-keygen -t rsa
  • Confirm the output filename of the key files. This can be changed to modify the location where the key files will be created and the name of the files.

  • Optionally, enter a passphrase if one is desired. Confirm passphrase, if one is used.

  • This will generate two files, a private key file (e.g., ~/.ssh/id_rsa) and a public key file (e.g., ~/.ssh/id_rsa.pub).

Add public key

The public key needs to be added to a file called authorized_keys within the user’s .ssh folder.

  • Create or open the /home/username/.ssh/authorized_keys file.

    Code Block
    sudo nano /home/username/.ssh/authorized_keys
  • Copy and append the text of the public key file into the authorized_keys file.

  • Set the rights to this file to 600 (owner read and write only).

    Code Block
    sudo chmod 600 /home/username/.ssh/authorized_keys
    sudo chown username:username /home/username/.ssh/authorized_keyss