Linux scp command is used to copy files and directories between Linux.
scp is a secure copy of the abbreviation, scp remote file copy is based on ssh command for secure login linux system.
scp is encrypted, rcp is not encrypted, scp is an enhanced version of rcp. Certainly better recommended encrypting
Common methods:
Copy a local file to a remote host: scp local_file the User @ Host: / dir scp -P 16022 local_file the User @ Host: / dir # ssh port is not the default port to be specified! Copy this file to the remote machine: scp the User @ Host: / dir local_file if it is a directory, you need to add -r parameter
Description:
- A state archives as much as possible, according to the status quo ante authority and other information are to be copied - r If the source contains a directory name, directory under the file will be copied to the destination Beijing and Taipei in sequence - f If the destination has the same file name file exists, the first copy to be deleted before re-copy -v and most linux command - v means the same as for the display can be used to view the progress of connection, authentication, or configuration errors. - C enable compression option -P select port Note -. P has been used RCP - . 4 forced to use IPV4 address - . 6 forced to use IPV6 address
copy
[[email protected] ~]$touch ab [[email protected] ~]$scp -P 20042 ab apps@192.168.111.153:/tmp The authenticity of host '[192.168.111.153]:20042 ([192.168.111.153]:20042)' can't be established. RSA key fingerprint is 3c:ff:51:9e:3c:cc:dd:66:42:f1:49:09:4f:5c:a0:96. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added '[192.168.111.153]:20042' (RSA) to the list of known hosts. apps@192.168.111.153's password: ab 100% 0 0.0KB/s 00:00
Detection:
[[email protected] ~]$cd /tmp/ [[email protected] tmp]$ls 90-nproc.conf.20200207 limits.conf.20200207 yum_save_tx-2020-02-18-09-20YQ6Wj3.yumtx ab sysctl.conf.20200207 Initialize.quan.sh yum.log
Note: The client and server are to be installed scp command packet
Otherwise, the following occurs:
[[email protected] ~]$scp -P 20042 ab apps@192.168.111.152:/tmp The authenticity of host '[192.168.111.152]:20042 ([192.168.111.152]:20042)' can't be established. RSA key fingerprint is 3c:ff:51:9e:3c:cc:dd:66:42:f1:49:09:4f:5c:a0:96. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added '[192.168.111.152]:20042' (RSA) to the list of known hosts. apps@192.168.111.152's password: bash: scp: command not found lost connection