BuycPanel Blog

BuycPanel Blog

Latest news and updates

Copying Accounts Using SSH Keys

Posted by Alex on 08 03 2017.

Whenever you need to copy cPanel accounts from one source server to another (destination server), you can do so in a variety of ways. One of these is through the use of SSH keys. This method allows you to create secure copies of your accounts, thus; minimizing the risks of potential data theft and even attacks.


A Quick Overview on SSH Keys


Linux/*BSD VMs-only supported programs, SSH keys are some of the most favored methods of gaining secure connections to remote machines. The development of these keys originate from the SSH cryptographic network protocol, the protocol responsible for encrypting the information stream between a user and a remote machine. And because it does not require a password, it delivers convenience as well, aside from ease-of-access.


Important Notes to Keep in Mind


Now that you know more about SSH keys, you can now proceed to the task at hand: copying accounts from one server to another using this secure method.


To make it easier for you, keep in mind the following definitions, which you will see across this document.


  • Destination Server – This pertains to the server where you want to have the copies of your accounts transferred to.
  • Source Server – This refers to the server where you will find the accounts you want to copy and transfer to the destination server.


Another thing to keep in mind is to never use any key other than the public key you will find on the source server. You should also not import the private key into the source server’s SSH keys.


Just in case you run into a few problems, like session timeouts, counter this by making the number of seconds in the “Number of seconds an SSH connection related to an account transfer may be inactive before timing out” setting higher. You will find this option under the Tweak Settings interface’s System section. Navigate to Home, then to the Server Configuration, and finally, the Tweak Settings menu.


Making Secure Copies of Accounts using SSH keys


In order to securely create copies of accounts via SSH keys, you have to use a root-user credential.


Once you have logged in as a root user, perform these steps to move accounts from the source to the destination server using SSH keys:


  1. Go to the destination server and log into it.
  2. Create, authorize, and download a pair of new SSH keys using the “Manage root’s SSH Keys” interface of your WHM account. Navigate to Home – Security Center – Manage root’s SSH Keys to find this interface.
  3. Go to your source server and log into it.
  4. Run the Manage root’s SSH Keys interface of WHM, which will allow you to import the newly created public key. Make sure you choose a unique key name. Paste this key in the text box labeled “Paste the Public Key.”
  5. Click the “Import” button.
  6. Click the “Return to SSH Manager” button.
  7. Go to the Public Keys table and find the key there. Once you do, click the “Manage Authorization” button, and then the “Authorize” button.
  8. Go back to your destination server and log in again.
  9. Finally, use the Transfer Tool interface in your WHM account to finalize the transfer.