Published on

SCP

Authors
  • avatar
    Name
    PatharaNor
    Twitter

secure-copy-thumbnail

Simple Usage

Not checking host key :

scp -o StrictHostKeyChecking=no -rp ./* username@hostname:/path/to/destination

Normally

To copy all from Local Location to Remote Location (Upload) :

scp -r /path/from/destination username@hostname:/path/to/destination

To copy all from Remote Location to Local Location (Download) :

scp -r username@hostname:/path/from/destination /path/to/destination

Custom Port where xxxx is custom port number :

scp -r -P xxxx username@hostname:/path/from/destination /path/to/destination

Copy on current directory from Remote to Local :

scp -r username@hostname:/path/from/file .

Help

  1. -r Recursively copy all directories and files.
  2. Always use full location from /, Get full location by pwd.
  3. scp will replace all existing files.
  4. Host name will be hostname or IP address.
  5. if custom port is needed (besides port 22) use -P portnumber.
  6. . (dot) - it means current working directory, So download/copy from server and paste here only.

⚠️ Caution

Sometimes the custom port will not work due to the port not being allowed in the firewall, so make sure that custom port is allowed in the firewall for incoming and outgoing connection.

avatar
PatharaNor
Tech Writer