First, what is the SCP?
SCP is a secure copy of the shorthand for remote copy of files under Linux commands, and its similar command has CP, but the CP is only on the local copy not across the server, and the SCP transmission is encrypted, may slightly affect the 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, at this time can also be through the SCP command can easily achieve the purpose;
Iii. methods of using SCP
1, get the files on the remote server
# cp-p 2424 username@ (IP or remote service alias):/home/username/a.tar.gz/home/username/
-P 2424 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;
Username@ip means to log on to the remote server using the specified user;
2, get the directory on the remote server
# scp-p 2424-r name@ip:/home/name/aaa//home/name/
The-r parameter represents recursive replication (that is, copying files and directories below the directory);
name@ip:/home/name/aaa/that the contents of the AAA folder in the user's home directory on the remote server are copied to the local directory;
/home/name/represents the path saved locally;
3, upload the local files to the server
# scp-p 2424 ~/aaa.tar.gz name@ip:/home/user/
Indicates that the files of the local user's home directory are uploaded to the user's home directory on the remote server;
4, upload the local directory to the server
# scp-p 2424-r ~/aaa/name@ip:/home/user/bbb/
It means that all files in the local home Directory AAA folder are passed to the BBB folder in the remote service user's home directory;
5, a number of possible useful parameters:
-P Port;
-p means to maintain file permissions;
-R represents recursive replication;
-V, as in most Linux commands, is used to show progress and can be used to view connectivity, authentication, or configuration errors;
-c enable compression options;
-4 forcibly uses IPV4 address;
-6 forcibly uses IPV6 address;
The above is a small set of Linux in the introduction of the SCP command to get the remote file method, I hope to help you, if you have any questions please give me a message, small series will promptly reply to everyone. Here also thank you very much for the cloud Habitat Community website support!