We use cookies
We use cookies to optimize our website. By continuing to browse the site, you agree to our use of cookies.
Control panel
  • Русский
  • Українська
  • English
  • UAH
  • USD
  • RUB
  • EUR
  • 0-800-307-307 Hotline
  • +38 (044) 392-74-33 Kiev
  • +38 (057) 728-39-00 Kharkiv
  • +38 (056) 794-38-31 Dnipro
  • +38 (032) 229-58-93 Lviv
  • +38 (048) 738-57-70 Odessa
  • +38(093) 170-15-42  Life
  • +38 (067) 400-88-44 Kievstar
  • +1(888)393-24-51  USA, Toll free
  • +44(131)507-01-14  Great Britain
  • +7 (499) 348-28-61 Moscow

2.10.9. SSH key authentication

To configure SSH key authentication, you need generate key pair and add a public key on the server.

Keys can be used, for example, when connecting via SSH or when setting up a connection in WinSCP.

Attention!

After migrations or transferring a hosting account to another server for technical reasons when connecting via SSH errors may occur “REMOTE HOST IDENTIFICATION HAS CHANGED"And"POSSIBLE DNS SPOOFING". You can fix the situation using the instructions in the articles with descriptions of these errors.

You can generate a key pair in any of the following ways:

The ability to generate keys in the console is available in the following operating systems:
  • Windows 10 with the update installed Fall Creators Update.
  • macOS.
  • Linux.

To generate a key pair in the console, do the following:

  1. Open your console:
  2. Go to directory .sshby running the command:
    • On Windows:
      cd %userprofile%\.ssh

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

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

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

      mkdir ~/.ssh
  3. Generate a key pair by running the command:
    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). Remember the output of the line “The key fingerprint is:».
    Keys with default parameters will be saved in a subdirectory .ssh user's home directory. These will be two files:

    • id_rsa - private key.
    • id_rsa.pub - public key.
  4. Display the contents of the public key by running the command:
    • On Windows:
      type %userprofile%\.ssh\id_rsa.pub
    • On Linux and macOS:
      cat ~/.ssh/id_rsa.pub
  5. Copy the displayed key content and add it on the server.
To generate a key pair using PuTTY, do the following:
  1. Generate a private key in PuTTY format using the PuTTYgen utility:
    1. Run puttygen.exe.
    2. Opposite "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 "Public key for pasting into OpenSSH authorized_keys file"And add it on the server.
  2. Start PuTTY.
  3. Open the settings section “Connection → SSH → Auth».
  4. Next to the field "Private key for Authentification»Click«Browse»And select the generated private key file.
  5. Save the settings and connect to the server.

To add a public key on the server, do the following:

  1. Open the section "Hosting SSHaccess».
  2. Enter the details of the new key and click "Add key»:
    • «New key"- paste the copied content of the public key.
    • «Name"- specify an arbitrary name for the key.
  3. After adding the key, display information about it below. Compare the fingerprint that was displayed during generation (displayed in the line opposite "The key fingerprint is:"), With a print in the line"Imprint»:
  4. If the prints match, then at connecting via SSH the password will no longer be prompted.