1.19. SSH Keys

Keys allow you to connect to servers via SSH or SFTP without entering a password.

To configure SSH key authentication, you need generate a pair of keys, add the public key in the account and link it to the desired service:

Account keys are managed in the section "Personal data → SSH keys".

  1. Openup Windows command line, macOS terminal or Linux terminal.
  2. Go to the directory .ssh:
    • On Windows:
      cd %userprofile%\.ssh

      If the directory does not exist and an error is returned "The system cannot find the path specified.", then create it with the command:

      mkdir %userprofile%\.ssh
    • On macOS and Linux:
      cd ~/.ssh

      If the directory does not exist, create it with the command:

      mkdir ~/.ssh
  3. Generate a key pair:
    ssh-keygen -t rsa -b 2048

    The program will ask you to specify a file name for saving keys and ask you to enter a secret phrase. Click on Enterto use the default options and the default filename id_rsa (if you provide your own filename, use it in all subsequent commands instead of id_rsa). With default parameters, the keys will be saved in a subdirectory .ssh the user's home directory. These will be two files: id_rsa — private key, id_rsa.pub - public key.
    Note If an error returns "'ssh' is not recognized as an internal or external command, operable program or batch file."then you need to enable OpenSSH on Windows.

  4. Print the contents of the public key:
    • On Windows:
      type %userprofile%\.ssh\id_rsa.pub
    • On macOS and Linux:
      cat ~/.ssh/id_rsa.pub
  5. Copy the displayed public key content and add the key in the account.
  1. Download and install PuTTY.
  2. Generate a private key in PuTTY format using the PuTTYgen utility:
    1. Run puttygen.exe from the installed PuTTY directory.
    2. Against "Generate a public/private key pair" click "Generate".
    3. Save the generated private key by clicking "Save private key".
    4. Copy the content of the public key from the field "Public key for pasting into OpenSSH authorized_keys file".
  3. Start PuTTY.
  4. Open the settings section "Connection → SSH → Auth".
  5. Near the field "Private key for Authentification" click "Browse" and select the generated private key file.
  6. Save the settings.
  7. Copy the displayed public key content and add the key in the account.

Saving a private key in PEM format

The PuTTYgen utility saves the private key in PPK format by default. To save in PEM format, in the main menu, press "Conversions → Export OpenSSH key".
  1. Open the section "Personal data → SSH keys".
  2. Click "Add to".
  3. Enter the key details and click "Add to":
    1. In field "Name" specify an arbitrary name for the key.
    2. Paste the copied content of the public key.

The added key will appear in the block "Added keys" and it can be tied to available services.

Attention!

When a key is removed from an account, it is automatically unbound wherever it was bound.
  1. Untie key from all hosting accounts where it was linked.
  2. Open the section "Personal data → SSH keys".
  3. Remove the key from the block "Added keys".
Content