Articles in this section

How to set up SSH keys for Plesk server?

kb: how-to Plesk for Linux ABT: Group A

Applicable to:

  • Plesk for Linux

Question

How to set up SSH keys for Plesk server?

Answer

  1. Connect to the server via SSH.

  2. Create the RSA Key Pair:

    # ssh-keygen -t rsa -b 2048

    Use default location /root/.ssh/id_rsa and setup passphrase if required.

  3. The public key is now located in /root/.ssh/id_rsa.pub
    The private key (identification) is now located in /root/.ssh/id_rsa file.

    Note: Permissions for the private key should be 0600

  4. Copy the public key to another server using the ssh-copy-id command:

    # ssh-copy-id user@203.0.113.2

    where user and IP address should be replaced with second server's credentials.

    Note: in case ssh-copy-id is missing on RHEL-based system, use the following command to install required package:

    # yum install openssh-clients

    Alternatively, copy the content of /root/.ssh/id_rsa.pub to /root/.ssh/authorized_keys on the second server.

    Note: permissions for the authorized_keys files should be set to 0600

SSH Keys Manager can be used to upload public part of SSH key pair to a Plesk server.

Additional information

After successful login using the SSH key, it is possible to restrict the password-based login:

  1. Open SSH server configuration file:

    # vi /etc/ssh/sshd_config

    1. Find the line that includes PermitRootLogin and set it to:

    CONFIG_TEXT: PermitRootLogin without-password

  2. Apply the changes:

    # service sshd reload

Was this article helpful?

Comments

0 comments

Please sign in to leave a comment.