What is Secure Copy?

Secure Copy

About Secure Copy or SCP:

Secure Copy or SCP transfers computer files securely from the local host to the remote host or between two remote hosts. It is based on SSH (Secure Shell) and RCP (Remote Copy) which allows the files to be copied over the network. RSH (Remote Shell) allows the commands to run on the remote host machine. SCP will ask for passwords or passphrases if they are needed for authentication. SCP protocol is a network protocol which is used upload the files to a server, optionally it includes the basic attributes like Access permission and timestamps. By the way, the client can download the files or directory from the server. SCP runs over TCP port 22 by default.

Secure Copy or SCP is referred to as additional of a mix of RCP and SSH than a protocol as a result of the file transfer is performed victimization RCP and authentication and cryptography are provided by the SSH Protocol. SCP maintains the confidentiality of info} being transferred and protects the credibility by block packet sniffers from extracting valuable information from the info packets


There are two types of modes in SCP. They are

1. Source mode:

It is similar to download. It reads the file from disk and then sends it to the client.

2. Sink mode:

It is similar to upload. The host machine accepts the client file which was sent by them and writes them on the remote host.

SCP use SSH for data transfer and provides the same level of security as SSH. While copying a source file to a target file which already exists in the current, SCP will replace the content in the target file. If the target file doesn’t exist, an empty or sample file is created in the same file name. Then it is filled with the source file contents.


1. Copy a file from remote to a localhost:

Syntax: $ scp [email protected]:filename.ext /some/local/directory

Username = your remote username.
Hostname.ext = hostname with its extension.
Filename.ext = the filename which you have to transfer from the remote host. Example: sample.txt file
Enter the local directory where you need to save the remote file.

2. Copy a file from local to a remote host: 

Syntax:$ scp filename.txt [email protected]: /some/remote/directory

3. Copy a file from remote to a remote host:

Syntax:$ scp [email protected]: /some/remote_directory/filename.ext \ [email protected]: /some/remote_directory/

4. Copy the files file1.txt and file2.txt from a local machine to the remote host’s home directory:

Syntax:$ scp file1.txt file2.txt [email protected]:~

5. Copy a file from local machine to the remote host using port 2264:

Syntax:$ scp -P 2264 file1.txt [email protected]:/some/remote_directory

6. Copy multiple files from the remote host to local machine:

Syntax:$ scp [email protected]:/some/remote_directory/\{file1.ext,file2.txt,file3.txt\}

7. Copy a file with encryption:

By default, SCP uses the Triple-DES cipher to encrypt the data that have been sent. The Blowfish cipher increases the speed. (~) symbol indicate the home directory.

Syntax:$ scp -c blowfish file1.txt [email protected]:~



scp [options] [[email protected]]host:source target
scp [options] source [source…] [[email protected]]host:target
scp [options] -ls [[email protected]]host:filespec

Some of the options are listed below

  • -1 forces SCP to use protocol 1.
  • -2 forces SCP to use protocol 2.
  • -4 forces SCP to use IPv4 address only.
  • -6 forces SCP to use IPv6 address only.
  • -agent enables the use of Pageant.
  • -B selects the batch mode.
  • -batch disables all the interactive prompts.
  • -c selects the cipher for encryption during data transfer.
  • -i indicates the private key file for authentication.
  • -l limits the usage of bandwidth in Kbit/s.
  • -noagent disables the usage of Pageant.
  • -p preserves the attributes of a file.
  • -P connects to a specific port.
  • -pw login with a specified password.
  • -r copies directories recursively.
  • -scp forces to use SCP protocol.
  • -sftp forces the use of SFTP protocol.
  • -unsafe allows server-side wildcards.
  • -V prints the information about the version and then exit.
  • -v displays the verbose message.
  • -q for quit.


Please enter your comment!
Please enter your name here