In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article Xiaobian introduces in detail for you "linux how to use scp to achieve server A to server B transfer files", the content is detailed, the steps are clear, the details are handled properly, I hope this "linux how to use scp to achieve server A to server B transfer files" article can help you solve doubts, following the editor's ideas slowly in-depth, together to learn new knowledge.
Scp is a file copy with security, which is logged in based on ssh. It is easy to operate, for example, to copy a current file to another remote host, you can use the following command.
The copy code is as follows:
Scp / home/daisy/full.tar.gz
Then you will be prompted to enter the login password of the root user on the other 172.19.2.75 host, and then you will start copy.
It is also easy to copy files from the remote host to the current system if you want to do the reverse.
The copy code is as follows:
Scp root@172.19.2.75:/home/root / home/daisy/full.tar.gz
This paper gives an example to explain the implementation process of file transfer between linux servers for your reference. The details are as follows.
1.1 transfer files normally, do not need to connect to server b through the proxy service, log in to server a, and execute
Scp test.sql user@server-b:path
Note: transfer the file test.sql to server b (user is the user name of server b, server-b is the ip,path of server b, specify the path to receive files on server b), enter the password of user
1.2 you need to access server b through a proxy and execute
Scp-oproxycommand='nc-v-xproxy:port h p 'test.sql user@server-b:path
Note: ip,port whose proxy is the proxy server is the port of the proxy server. Enter the password of user by entering enter.
Alternatively, you can use the sftp command, which is basically the same format as above:
Sftp-oproxycommand='nc-v-xproxy:port h p 'user@server-b port
Description: the latter port is the port of server b
1.3 transfer files using scp
1) download files from the server
Scp username@servername:/path/filename / tmp/local_destination
For example, scp codinglog@192.168.0.101:/home/kimi/test.txt downloads the file / home/kimi/test.txt on 192.168.0.101 to / tmp/local_destination
2) upload local files to the server
Scp / path/local_filename username@servername:/path
For example, scp / var/www/test.php codinglog@192.168.0.101:/var/www/ transfers the test.php file in the local / var/www/ directory
Upload to the / var/www/ directory on the server 192.168.0.101
3) download the entire directory from the server
Scp-r username@servername:remote_dir/ / tmp/local_dir
For example: scp-r codinglog@192.168.0.101 / home/kimi/test / tmp/local_dir
4) upload the directory to the server
Scp-r / tmp/local_dir username@servername:remote_dir
For example:
Scp-r test codinglog@192.168.0.101:/var/www/ uploads the test directory under the current directory to the server's / var/www/ directory
After reading this, the article "how linux uses scp to transfer files from server A to server B" has been introduced. If you want to master the knowledge of this article, you still need to practice and use it before you can understand it. If you want to know more about related articles, please pay attention to the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.