Today, the file is copied from the remote server to the local, the remote file is A.cap, under the user USERS/CCC, the local user is Aaa,ip 192.168.1.11,
The default port is 22, using the command: SCP a.cap aaa@192.168.1.11/users/ccc/a.cap/home/aaa/a.cap
first, what is the SCP.
The SCP is a secure copy shorthand for remote copy of files under Linux, and a similar command has CP, but the CP is only copied on the local computer, not across servers, and the SCP transmission is encrypted. may have a slight impact on speed. second, what is the use of SCP.
1, we need to get a file on the remote server, the remote server has neither configured the FTP server, did not open the Web server, did not do the sharing, can not get the file through the regular way, only need to pass the SCP command can easily achieve the goal.
2, we need to upload the files on this machine to the remote server, the remote server does not open the FTP server or share, can not be uploaded through the normal way is, only need to pass the SCP command can be easily achieved. Iii. methods of using SCP
1, get the files on the remote server
Scp-p root@www.lampblog.net:/root/lnmp0.4.tar.gz/home/lnmp0.4.tar.gz
The upper port caps p is the parameter, 22 indicates that the port after the SSH port is changed, and if the SSH port is not changed, you do not need to add the parameter. Root@www.lampblog.net indicates that using root to log on to a remote server www.lampblog.net,:/root/lnmp0.4.tar.gz represents a file on a remote server, the last face of/home/ Lnmp0.4.tar.gz represents the path and file name that is saved locally.
2, get the directory on the remote server
Scp-p 22-r root@www.lampblog.net:/root/lnmp0.4//home/lnmp0.4/
The upper port caps p is the parameter, 22 indicates that the port after the SSH port is changed, and if the SSH port is not changed, you do not need to add the parameter. The-r parameter represents a recursive replication (that is, copying the files and directories underneath the directory); root@www.lampblog.net indicates that using root to log on to a remote server www.lampblog.net,:/root/lnmp0.4/represents a directory on a remote server. The/home/lnmp0.4/on the last side represents the path saved locally.
3, upload the local files to the server
Scp-p 22/home/lnmp0.4.tar.gz root@www.lampblog.net:/root/lnmp0.4.tar.gz
The upper port caps p is the parameter, 22 indicates that the port after the SSH port is changed, and if the SSH port is not changed, you do not need to add the parameter. /home/lnmp0.4.tar.gz represents the path and file name of the file to be uploaded locally. Root@www.lampblog.net indicates that using the root user to log on to the remote server www.lampblog.net,:/root/lnmp0.4.tar.gz represents the directory and file name saved on the remote server.
4, upload the local directory to the server
Scp-p 22-r/home/lnmp0.4/root@www.lampblog.net:/root/lnmp0.4/
The upper port caps p is the parameter, 22 indicates that the port after the SSH port is changed, and if the SSH port is not changed, you do not need to add the parameter. The-r parameter represents a recursive replication (that is, copying the files and directories under the directory);/home/lnmp0.4/represents the directory to be uploaded, root@www.lampblog.net means to log on to the remote server using root www.lampblog.net,:/ ROOT/LNMP0.4/represents the directory location that is saved on the remote server.
5, several possible parameters:
-V is the same as-V in most Linux commands to show progress. Can be used to view connections, authentication, or configuration errors.
-C enables compression options.
- 4 forcibly use the IPV4 address.
-6 forcibly uses the IPV6 address.