Copying a file to another server through SSH

Expertise level: Medium

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 /path/to/the/directory/
  • Type the following command (make sure you replace the IP address and the file name):
scp file.txt 10.10.10.10:/root/

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

  • You will be prompted to enter the root password of the remote 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 10.10.10.10:/root/

For more information on how to use the scp command, please consult this link:

http://www.cyberciti.biz/faq/transfer-files-from-unix-server/

Have more questions? Submit a request

0 Comments

Article is closed for comments.
Powered by Zendesk