- create a folder of own user and become the owner of that folder by
chown: folder_name
scp gitlabhq_stag.backup royki@gitlab127.0.0.1.net:/gitlab-data/dump
scp file.txt royki@10.10.0.2:/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 royki@10.10.0.2:/remote/directory
- copy a directory from a local to remote system use the -r option
scp -r /local/directory royki@10.10.0.2:/remote/directory
- Copy a Remote File to a Local System using the scp Command
scp royki@10.10.0.2:/remote/file.txt /local/directory
- Copy a File Between Two Remote Systems using the scp Command
scp user1@host1.com:/files/file.txt user2@host2.com:/files
- To route the traffic through the machine on which the command is issued use the -3 option:
scp -3 user1@host1.com:/files/file.txt user2@host2.com:/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 your_username@remotehost.com:~
- 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 your_username@remotehost.com:~
–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.