About FTP:

File Transfer Protocol(FTP) is widely used to transfer files between two servers. But it transfers files in an unencrypted format which is not secure. Any unauthorized users can view the file and modify it. So FTP is used only in limited cases. To transfer files securely between two servers in an encrypted format, SCP command is used.

What is SCP?

SCP(Secure Copy Protocol) is a network protocol used to transfer files securely between a local host and a remote host or between two remote hosts. SCP command uses SSH(Secure Shell) to transfer data securely with authentication. SCP command encrypts both the file and passwords exchanged so that any unauthorized user cannot view it. SCP runs over TCP port 22 by default.

The syntax for SCP:

The syntax of SCP is similar to the syntax of cp(copy).

To copy a file to host, use

scp SourceFile user@host:directory/TargetFile

To copy a file from host use SCP

user@host:directory/SourceFile TargetFile

If the remote host uses the port number other than the default port 22, it should be specified.

For example like this,

 scp -P 2222 user@host:directory/SourceFile TargetFile

Parameters of SCP:

Parameter -v helps in debugging connection, authentication and configuration problems.

Example: scp -v Label.pdf axes@202.x.x.x:.

The Parameter -p gives the modification time, access time and also the connection speed will appear on the screen.

Example: scp -p Label.pdf axes@202.x.x.x:.

Parameter -C helps to transfer larger files quickly. It will compress the file on the network. After reaching the destination it will return to the original as before the compression.

Example: scp -Cpv messages.log axes@202.x.x.x:.

 In Parameter -c helps in encrypting the files. SCP uses “AES-128” to encrypt the files by default. This parameter helps in changing the algorithm used for encryption. It uses lower case ‘c’.

Example: scp -c 3des Label.pdf axes@202.x.x.x:.

It uses 3des algorithm for encryption.

Parameter -l helps to limit the bandwidth for users.

Example: scp -l 400 Label.pdf axes@202.x.x.x:.

Here the value 400 is used to limit the bandwidth.

Parameter -P helps to change the port. SCP uses port 22 by default. This parameter helps in changing the desired port number to use. Make sure it uses uppercase ‘P’.

Example: scp -P 2249 Label.pdf axes@202.x.x.x:.

Parameter -r is used to copy files inside a directory recursively. After copying a file, at the destination server, you will find a directory named “documents” with all its files. The folder documents are automatically created.

Example: scp -r documents axes@202.x.x.x:.

Parameter -q helps to disable the progress meter and warning or diagnostic messages from SCP.

Example: scp -q Label.pdf axes@202.x.x.x:.

Parameter -F is used on the company network. When you are on the public network you can skip it.

Categorized in: