Skip to content

Instantly share code, notes, and snippets.

@royki
Last active November 29, 2020 19:32
Show Gist options
  • Save royki/7e5f83887e2367e1cd3b340830f3f6e6 to your computer and use it in GitHub Desktop.
Save royki/7e5f83887e2367e1cd3b340830f3f6e6 to your computer and use it in GitHub Desktop.
copy commad over ssh

To copy using scp and no password

  • create a folder of own user and become the owner of that folder by chown: folder_name

copy over ssh using scp

Copy a Local File to a Remote System with the scp Command

  • 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:
  • copy a directory from a local to remote system use the -r option
  • Copy a Remote File to a Local System using the scp Command
  • Copy a File Between Two Remote Systems using the scp Command
  • To route the traffic through the machine on which the command is issued use the -3 option:

scp Performance

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 options:

  • –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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment