- create a folder of own user and become the owner of that folder by
chown: folder_name
scp gitlabhq_stag.backup [email protected]:/gitlab-data/dump
scp file.txt [email protected]:/remote/directory
- If SSH on the remote host is listening on a port other than the default 22 then you can specify the port using the -P argument:
scp -P 2322 file.txt [email protected]:/remote/directory
- copy a directory from a local to remote system use the -r option
scp -r /local/directory [email protected]:/remote/directory
- Copy a Remote File to a Local System using the scp Command
scp [email protected]:/remote/file.txt /local/directory
- Copy a File Between Two Remote Systems using the scp Command
scp [email protected]:/files/file.txt [email protected]:/files
- To route the traffic through the machine on which the command is issued use the -3 option:
scp -3 [email protected]:/files/file.txt [email protected]:/files
By default scp uses the Triple-DES cipher to encrypt the data being sent. Using the Blowfish cipher has been shown to increase speed. This can be done by using option -c blowfish in the command line.
scp -c blowfish some_file [email protected]:~
- It is often suggested that the
-C
option for compression should also be used to increase speed. The effect of compression, however, will only significantly increase speed if your connection is very slow. Otherwise it may just be adding extra burden to the CPU. An example of using blowfish and compression:scp -c blowfish -C local_file [email protected]:~
–r
Recursively copy entire directories. Note that this follows symbolic links encountered in the tree traversal.-C
Compression enable. Passes the -C flag to ssh to enable compression.-l
limit – Limits the used bandwidth, specified in Kbit/s.-o
ssh_option – Can be used to pass options to ssh in the format used in ssh_config.-P
port – Specifies the port to connect to on the remote host. Note that this option is written with a capital ‘P’.-p
Preserves modification times, access times, and modes from the original file.-q
Quiet mode: disables the progress meter as well as warning and diagnostic messages from ssh.-v
Verbose mode. Print debugging messages about progress. This is helpful in debugging connection, authentication, and configuration problems.