当前位置:网站首页>SCP command details
SCP command details
2022-04-23 04:56:00 【Huang Jiajun】
In common cases, say first :
Two machines IP Respectively :A.104.238.161.75,B.43.224.34.73.
stay A Operation on the server , take B Server /home/lk/ All files in the directory are copied to the local /root Under the table of contents , The order is :scp -r [email protected]:/home/lk /root.
stay A On the server /root/lk All the files in the directory are transferred to B Of /home/lk/cpfile Under the table of contents , The order is :scp -r /root/lk [email protected]:/home/lk/cpfile.
scp When copying across machines, in order to improve the security of data , Used ssh Connection and encryption , If the machine is configured with ssh Password free login , That's in use scp You don't have to enter a password when you're in .
Detailed command :
scp yes secure copy Abbreviation , Used in Linux Under the command to copy files remotely , Similar orders are cp, however cp It's just that copying on the local machine can't cross servers , and scp The transmission is encrypted . It may affect the speed a little . When your server hard disk becomes read-only read only system when , use scp I can help you move the files out . in addition ,scp It doesn't take up resources , It will not increase the system load much , At this point ,rsync It's far less than that . although rsync Than scp It will be faster , But when there are lots of small files ,rsync It will cause the hard disk I/O Very high , and scp Basically does not affect the normal use of the system .
1. Command format :
scp [ Parameters ] [ The original path ] [ The target path ]
2. Command function :
scp yes secure copy Abbreviation , scp yes linux Based on ssh Log in for secure remote file copy command .linux Of scp Commands can be found in the linux Copy files and directories between servers .
3. Command parameter :
-1 mandatory scp Command usage protocol ssh1
-2 mandatory scp Command usage protocol ssh2
-4 mandatory scp The command only uses IPv4 Addressing
-6 mandatory scp The command only uses IPv6 Addressing
-B Use batch mode ( Do not ask for transmission password or phrase during transmission )
-C Allow compression .( take -C The sign is passed on to ssh, To turn on compression )
-p Keep the modification time of the original document , Access time and access rights .
-q Do not show transfer progress bar .
-r Recursively copy the entire directory .
-v Detailed display output .scp and ssh(1) The debugging information of the whole process will be displayed . This information is used to debug connections , Validation and configuration issues .
-c cipher With cipher Encrypt the data transmission , This option will be passed directly to ssh.
-F ssh_config Designate an alternative ssh The configuration file , This parameter is passed directly to ssh.
-i identity_file The key file used to read the transfer from the specified file , This parameter is passed directly to ssh.
-l limit Limit the bandwidth that users can use , With Kbit/s In units of .
-o ssh_option If you are used to using ssh_config(5) Parameter passing method in ,
-P port Notice that it's capital P, port Is the port number used for data transmission
-S program Specify the program to use when encrypting the transmission . This procedure must be able to understand ssh(1) The option to .
4. Using examples :
scp Overview of practical application of command :
Copy from local server to remote server :
(1) Copy file :
Command format :
scp local_file remote_username@remote_ip:remote_folder
perhaps
scp local_file remote_username@remote_ip:remote_file
perhaps
scp local_file remote_ip:remote_folder
perhaps
scp local_file remote_ip:remote_file
The first 1,2 User name specified , After the command is executed, you need to enter the user password , The first 1 Only remote directories are specified , The file name does not change , The first 2 Specified file name
The first 3,4 No user name specified , After the command is executed, you need to enter the user name and password , The first 3 Only remote directories are specified , The file name does not change , The first 4 Specified file name
(2) duplicate catalog :
Command format :
scp -r local_folder remote_username@remote_ip:remote_folder
perhaps
scp -r local_folder remote_ip:remote_folder
The first 1 User name specified , After the command is executed, you need to enter the user password ;
The first 2 No user name specified , After the command is executed, you need to enter the user name and password ;
版权声明
本文为[Huang Jiajun]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230454290430.html
边栏推荐
- Teach you how to build the ruoyi system by Tencent cloud
- Progress of innovation training (IV)
- Innovation training (VI) routing
- Use AES encryption - reuse the wisdom of predecessors
- PHP+MySQL 制作留言板
- COM in wine (2) -- basic code analysis
- List remove an element
- Unity3D 实用技巧 - 理论知识库(一)
- 多线程基本概念(并发与并行、线程与进程)和入门案例
- Introduction to raspberry pie 3B - system installation
猜你喜欢

CLion+OpenCV identify ID number - detect ID number

The 8 diagrams let you see the execution sequence of async / await and promise step by step

Introduction to raspberry pie 3B - system installation

PHP+MySQL 制作留言板

POI export message list (including pictures)

COM in wine (2) -- basic code analysis

【数据库】MySQL基本操作(基操~)

跨境电商 | Facebook 和 Instagram:哪个社交媒体更适合你?

2022/4/22

redis数据类型有哪些
随机推荐
JS détermine si la chaîne de nombres contient des caractères
PHP 统计指定文件夹下文件的数量
The unity camera rotates with the mouse
unity摄像机旋转带有滑动效果(自转)
Innovation training (10)
ApplicationContext injection bean
Use model load_ state_ Attributeerror appears when dict(): 'STR' object has no attribute 'copy‘
Spark small case - RDD, spark SQL
Set Chrome browser background to eye protection (eye escort / darkreader plug-in)
简单的拖拽物体到物品栏
2022/4/22
Innovation training (VI) routing
Unity rawimage background seamlessly connected mobile
退出vim的方法
Getprop property
[database] MySQL single table query
泰克示波器DPO3054自校准SPC失败维修
JS generates a specified number of characters according to some words
QPushbutton 槽函数被多次触发
Manually write smart pointer shared_ PTR function