Before proceeding with this guide, you need to whitelist your IP Address for SSH Access on the Plesk firewall.


Once you’ve done that, you can follow these steps to create a new SSH Key for the Plesk server.

Step 1 - Generate SSH key from server end

  1. Connect to the server via SSH.

  2. Create the RSA key pair by entering the following command:

    ssh-keygen -t rsa -b 2048

  3. Nominate a file name for your SSH keys and then enter a passphrase ( Keep the password safely as can't be reset ). The SSH keys will now be saved in your root document folder.

    Public key -- /root/.ssh/id_rsa.pub
    Private key -- /root/.ssh/id_rsa

  4. Open the public key file, copy the line of text and paste it into the SSH authorized_keys file ( /root/.ssh/authorized_keys ).

  5. Download the private key via the alternative below

    - Move the private key to your own domain web folder and download with FTP
    - Download using SFTP with root login
    - Open the private key file and manually copy and paste into your local file as text.

  6.  Next, if you’d like to convert the key to .ppk format for use in Putty or any other SSH client, you can follow these steps to do so:

    a. Open PuTTYgen on your computer.
    b. Click Load, and in the dialog window change the format to All Files (*.*).
    c. Navigate to your private key file and load it into PuTTYgen. Enter your passphrase if you set one up earlier.
    d. You should get a message “Successfully imported foreign key…”. Click OK.
    e. Click Save the private key next to Save the generated key.

  7. Done! You now have a private key in .ppk format, ready to use in PuTTY.


Step 2 - Add the private key to pageant.exe for server remote authentication via SSH key.

  1. Open pageant.exe from your computer and will appear at Windows taskbar
  2. Add private key( PPK format file ).
  3. Enter private key passphare that prompts.
  4. Done adding the private key.
  5. Open a new session from putty, entering your CentOS server IP and SSH port. A custom SSH port 8288 is configured for our server.
  6. Enter username "root", hit enter to remotely access the server with SSH key.


Step 3 - Disable SSH password authentication


For security reasons, it is recommended to leave SSH password authentication disabled. This simply means that password authentication is disabled and have to use an SSH key for remotely accessing the server. 


a. Log into the server using SSH

b. Open SSH server configuration file /etc/ssh/sshd_config and edit with your favorite text editor: 

[root@root ~]# nano /etc/ssh/sshd_config

c. Find the line that includes PasswordAuthentication and set it to:

PermitRootLogin no

d. Ensure that you are logged into the box with another shell before restarting SSHD to avoid locking yourself out of the server. Reload/ Restart the SSHD service

[root@root ~]# service sshd reload

You now are able to connect to your server via SSH with the root user without input the root password.

The failure login with SSH key demonstration.


The success login through SSH key demonstration.