Beginners Guide: Copy Your Files To Remote Server With scp

When you are moving your website to another server or maybe copying a file to a remote host, there are lot ways to do that. One of them is using “scp” or secure copy. scp is used for copying file from local to remote host securely. It uses ssh for data transfer and provides the same authentication and same level of security as ssh.

Copy a file from a remote host to the local host:

1
scp username@remotehost.com:file.txt /path/local/directory

Copy a file from the local host to a remote host:

1
scp /path/local/directory  username@remotehost.com:file.txt

Copy a directory from local host to a remote host

1
scp -r /path/local/directory username@remotehost.com:/path/remote/directory

Copy a directory from remote host to a local host

1
scp -r username@remotehost.com:/path/remote/directory /path/local/directory

Copy a file from remote host 1 to remote host 2 (copy file between remote host)

1
scp username@remotehost1.com:/path/remote/host1/file.txt username@remotehost2.com:/path/remote/host2/

Use blowfish cipher to encrypt the data being sent:

1
scp -c blowfish /path/local/directory  username@remotehost.com:file.txt

Compress the file before send:

1
scp -c blowfish -C /path/local/directory  username@remotehost.com:file.txt

Give me your feedback

This site uses Akismet to reduce spam. Learn how your comment data is processed.