Home » 2014 » February » 12 » SCP a secure copy program in Linux

4:47 PM
SCP a secure copy program in Linux

Share on Google+

SCP is a program used to copy files between hosts on a network.  It uses ssh(1) for data transfer, and uses the same authentication and provides the same security as ssh(1).  Unlike rcp(1), scp will ask for passwords or passphrases if they are needed for authentication.

Any file name may contain a host and user specification to indicate that the file is to be copied to/from that host.  Copies between two remote hosts are permitted.

 

Format:  

scp [-1246BCpqrv] [-c cipher] [-F ssh_config] [-i identity_file] [-l limit] [-o ssh_option] [-P port] [-S program] [[user@]host1:]file1 [...] [[user@]host2:]file2

 


For eg. To copy a file from your system to any other system, use below command 

user1@host1:~> scp abc1.txt host2:~/test
Enter Your Windows Password:
abc1.txt                                                                                            100%   19     0.0KB/s   00:00

 

The above command will copy the file abc1.txt of home directory of host1 to the ~/test directory of host2

 

If you don't specify any directory on the destination host, the file will be copied to home directory of remote host. Lets say: See below command:
 
user1@host1:~> scp abc1.txt host2:
Enter Your Windows Password:
abc1.txt                                                                                            100%   19     0.0KB/s   00:00
 

Some frequent options: 

-p      It preserves modification times, access times, and modes from the original file.

-r      Recursively copy entire directories

-c cipher
             Selects the cipher to use for encrypting the data transfer.  This option is directly passed to ssh(1).

 

 
 

Category: Open System-Linux | Views: 2158 | Added by: shanky | Tags: secure file transfer in linux, copy files in linux, SCP | Rating: 5.0/1

Related blogs


You may also like to see:


[2016-05-11][Open System-Linux]
An example to understand bash exit code $? in linux.
[2015-06-01][Open System-Linux]
DIG command : A DNS lookup utility
[2014-10-26][Open System-Linux]
XMLLINT command in linux : a validating XML parser
[2014-03-25][Open System-Linux]
Create a new user in Linux system: useradd
[2015-03-23][Open System-Linux]
FSCK : Checking and reparing filesystems in Linux

Total comments: 0
ComForm">
avatar