This article will assist you in transferring web content between two remote Linux machines, for which you can use any of the methods listed below.
cPanel to cPanel migration
cPanel provides you with the transfer tool to move your websites from other remote hosts. If both machines have cPanel installed, you can quickly transfer the files between them.
Refer to our knowledgebase article – How to migrate your website using cPanel's copy an account option.
If your existing cPanel accounts are hosted under shared hosting, your current web host may not allow cPanel to cPanel migration. In such a scenario, you can take a backup of cPanel accounts and move the backup through FTP.
You may find this article helpful in transferring cPanel accounts manually.
Manual migration using SFTP
SFTP (SSH File Transfer Protocol or Secure File Transfer Protocol) offers a secure connection to transfer files between Linux machines. SFTP is preferable to FTP because SFTP uses the SSH protocol to authenticate and establish a secure connection.
Connect to VPS using SFTP
If you could connect to your VPS through SSH, you have all the requirements to use SFTP. Connect to your VPS through sFTP via the following command –
You will be prompted for the password, specify your SSH password, and connect to the remote system; this will also change the shell prompt to SFTP. After connecting to your remote machine via SFTP, you can navigate the remote machine file system using the cd command.
The pwd command is used to know the current working directory. To view the contents of the current directory ls command is used.
phpinfo.php info.html Directory1 Directory2
When you want to traverse the local file system, you can direct commands towards the local file system by adding "l" before any command. For example, you can print the local working directory with the command lpwd.
Local working directory: /home/user/Desktop
Similarly, we can list the contents of the current directory on the local machine using the lls command and change the directory using the lcd command.
Upload/Transfer local files to VPS
You can upload/ transfer local files to VPS using the put command.
Uploading file_name to /home/user/directory/file_name
To copy an entire local directory to VPS, you can execute the following command –
put -r local_dir_name
Download VPS files to local computer
Sometimes, you are required to download VPS files to the local computer; it can be accomplished by issuing the following command –
Fetching /home/user/Desktop/file_name to file_name
If you want to copy the whole directory along with its contents, issue the following command –
get -r remote_dir_name