Copying a file to another server through SCP

To copy a file to another server, use the following procedure:

  • Log in to your server with SSH as root.
  • Navigate to the directory where there are the files to be transferred, using cd command:
cd /home/albert
  • Type the following command (make sure you replace the IP address and the file name):
scp move.txt 100.101.102.11:/root/

In this example, 100.101.102.11 is the IP address of the destination server, and /root/ is the destination folder of move.txt

  • You will be prompted to enter the root password of the remote server.

Now the move.txt file has been successfully transferred to  destination server.

To copy a folder and its contents to another server, please use the following procedure:

If you need to copy a folder and its contents, you should use the -r (recursive) option with the command like this:

scp -r foldername 100.101.102.11:/root/

Now you know how to transfer the files from one server to another servers.

 

Related posts

Leave a Comment