How to: Manually transfer an account between servers

For cPanel & WHM version 11.40


Sometimes, accounts are too large to move using the WHM Transfers set of features. However, you can still move the accounts manually.

To begin this process, you will need to log into your server as the root user.

In this tutorial, we will use the following information:

Username user

We will begin by creating a temporary directory that will store certain parts of the account we wish to transfer.

Creating a temporary directory using the mkdir command

To create a temporary directory, we will need to use the mkdir command.

mkdir /home/user-temp

This command will not produce any output. It will create a directory called user-temp inside of the /home directory.

Creating a compressed backup of public_html

Most of an account's disk space usage will occur within its public_html directory. So, we can reduce the size of the transfer by temporarily omitting the public_html directory from the transfer process. To do so, we will need to create a compressed backup of the directory.

To create a compressed backup, use the tar command. tar is an archive utility that is also capable of compressing the archive, when given the appropriate arguments.

 tar cvzf /home/user-temp/user-backup.tar.gz /home/user/public_html

In the example above, we are creating a compressed archive of the public_html directory at /home/user-temp/user-backup.tar.gz.

In this case, the tar utility receives:

  • 4 parameters (cvzf)
  • 2 input variables (/home/user-temp/user-backup.tar.gz and /home/user/public_html).

Parameter Description
c Creates a new archive. We have to pass the tar utility the -c argument as it tells the utility to create a new archive versus, for example, extracting an existing archive.
v Prints to the CLI verbose information about what tar is doing. While this argument is not required, it makes it easy to see what is going on, should you encounter any errors.
z Uses the gzip compression utility to compress the new archive. This saves disk space. For more information about gzip, visit's gzip man page.
f Causes the tar utility to read from and write to the specified file. In this case, we are writing to a file called user-backup.tar.gz.

Moving public_html using the mv command

Now that we created a compressed backup of the public_html directory, we can move the public_html directory to the temporary folder we created in the first step. To do so, we can use the mv command.

mv /home/user/public_html /home/user-temp/

ALERT! Warning: You should never remove the public_html directory before the transfer is complete. You should make sure to keep a copy of the public_html directory at all times during the transfer process, so that the site can still be restored should you encounter any failures along the way.

Creating compressed backups of logs

Large websites often have large logs that accompany them. We can save ourselves more transfer time and disk space if we create a compressed backup of these logs.

We can find the domain's Apache weblogs in /usr/local/apache/domlogs.

Let's follow the same set of steps as above. We will create a compressed backup of the domain's weblogs and move the weblogs from their current location in usr/local/apache/domlogs/ to the temporary directory.

root@publicdocs [~]# tar -cvzf /home/user-temp/user-logs.tar.gz /usr/local/apache/domlogs/
root@publicdocs [~]# mv /usr/local/apache/domlogs/ /home/user-temp/

  1. The first command creates the compressed backup of the domain's logs in /home/user-temp/user-logs.tar.gz.
  2. The second command moves the existing log files to the temporary directory.

Manually transferring the compressed backups using the scp command

There are several methods for transferring the compressed backups we have created. For this article, we'll use the scp protocol.

scp stands for secure copy. We can use this protocol to transfer files between servers. This method is fast and secure, and we will not have to use any arguments. We simply need to give the scp utility a file to move and place to go.

scp $local file to move $remote host:/path/to/new/file

For our purposes, let's pretend that we have root access on the remote machine, and that the remote host is Along with the username and password for the remote server, we'll need to specify a path for the files we want to copy on the remote server. In this case, let's pretend the remote directory is /home/temp/.

scp /home/user-temp/user-logs.tar.gz
scp /home/user-temp/user-backup.tar.gz

Depending on the remote server's configuration, you may need to specify a few arguments to scp.

Argument Description Example
-P This argument allows you to specify a port number. You will need to specify the port number if the remote server does not use the default SSH port (22). scp -P 372 /home/user-temp/user-logs.tar.gz
-i This argument allows you to specify a key file if the remote server requires key-based authentication. scp -i key-name /home/user-temp/user-logs.tar.gz
-v This argument will cause the scp utility to produce verbose output. You should use this argument if you are experiencing problems with the scp utility. scp -v /home/user-temp/user-logs.tar.gz

These 2 commands will individually transfer the compressed backups we created of the user's public_html and Apache logs to the /home/temp directory on the other server. You will be prompted for the password when you connect to the other server, so make sure you have that information at hand.

Now that we have moved the 2 largest parts of the website manually, we can use the WHM Copy an account from another server interface to move the rest of the account information. This should be a speedy process.

Extracting the compressed backups

Once we have transferred our 2 compressed backups over and finished transferring the account, we'll need to extract the compressed backups to their appropriate locations. To do so, we'll need to use the tar utility again. This time, we will pass the tar utility a different set of arguments.

tar -xvzf $file-to-extract.tar.gz $/path/to/place/contents/

As you can see, we simply need to change the -c argument to -x. This argument tells the tar utility to extract information from the files specified, rather than to create a file.

For example, let's restore the user's public_html to /home/user on the new system. We'll also need to extract the Apache logs to /usr/local/apache/domlogs.

tar -xvzf /home/temp/user-backup.tar.gz /home/user/
tar -xvzf /home/temp/user-logs.tar.gz /usr/local/apache/domlogs/

Once you have completed the transfer and restored the backups you have created, you should have successfully moved the account.

Topic revision: r9 - 18 Oct 2013 - 17:08:15 - Main.LaurenceSimon
AllDocumentation/WHMDocs.HowToManuallyTransferAccounts moved from Sandbox.HowToManuallyTransferAccounts on 30 Jun 2011 - 15:27 by Main.JustinSchaefer - put it back