当前位置: 首页 > news >正文

Secure Copy Protocol or SCP - 安全拷贝协议

Secure Copy Protocol or SCP - 安全拷贝协议

  • 1. scp 文件传输
    • 1.1. 将远程文件拷贝到本地
    • 1.2. 将本地文件拷贝到远程
    • 1.3. 将远程目录拷贝到本地
  • References

Secure Copy (remote file copy program)

The SCP program is a software tool implementing the SCP protocol as a service daemon or client. It is a program to perform secure copying. The SCP server program is typically the same program as the SCP client. The SCP Server software can be installed on a Regular Machine and be configured to only accept SCP Traffic on port 22 through the firewall for greater security.

Perhaps the most widely used SCP program is the command line scp program, which is provided in most SSH implementations. The scp program is the secure analog of the rcp command. The scp program must be part of all SSH servers that want to provide SCP service, as scp functions as SCP server too.

Some SSH implementations provide the scp2 program, which uses the SFTP protocol instead of SCP, but provides the very same command line interface as scp. scp is then typically a symbolic link to scp2.

Copying file to host:

scp SourceFile user_name@host_ip:directory/TargetFile

Copying file from host:

scp user_name@host_ip:directory/SourceFile TargetFile
scp -r user_name@host_ip:directory/SourceFolder TargetFolder

Note that if the remote host uses a port other than the default of 22, it can be specified in the command. For example, copying a file from host:

scp -P 2222 user_name@host_ip:directory/SourceFile TargetFile

1. scp 文件传输

将本地文件拷贝到远程:scp 本地路径/文件名 用户名@计算机 IP 或计算机名称:远程路径
将远程文件拷贝到本地:scp 用户名@计算机 IP 或计算机名称:远程路径/文件名 本地路径
将本地目录拷贝到远程:scp -r 本地路径/目录名 用户名@计算机 IP 或计算机名称:远程路径
将远程目录拷贝到本地:scp -r 用户名@计算机 IP 或计算机名称:远程路径/目录名 本地路径

1.1. 将远程文件拷贝到本地

strong@foreverstrong:~$ scp yongqiang@***.***.***.***:/home/yongqiang/darknet_work/darknet_180516/darknet-master.zip /home/strong/Desktop/download/
yongqiang@***.***.***.***'s password: 
darknet-master.zip                                                                                                                   100% 3571KB   3.5MB/s   00:01    
strong@foreverstrong:~$
or
strong@foreverstrong:~/Desktop/download$ scp yongqiang@***.***.***.***:/home/yongqiang/darknet_work/darknet_180516/darknet-master.zip .
yongqiang@***.***.***.***'s password: 
darknet-master.zip                                                                                                         100% 3571KB   3.5MB/s   00:00    
strong@foreverstrong:~/Desktop/download$ ll
total 3580
drwxrwxr-x 2 strong strong    4096 May 27 11:46 ./
drwxr-xr-x 7 strong strong    4096 May 27 11:37 ../
-rw-rw-r-- 1 strong strong 3656551 May 27 11:46 darknet-master.zip
strong@foreverstrong:~/Desktop/download$

1.2. 将本地文件拷贝到远程

strong@foreverstrong:~$ scp /home/strong/Desktop/download/darknet-master.zip yongqiang@***.***.***.***:/home/yongqiang/Downloads/
yongqiang@***.***.***.***'s password: 
darknet-master.zip                                                                                                                       100% 3571KB   3.5MB/s   00:00    
strong@foreverstrong:~$
or
strong@foreverstrong:~/Desktop/download$ scp ./darknet-master.zip yongqiang@***.***.***.***:/home/yongqiang/Downloads/
yongqiang@***.***.***.***'s password: 
darknet-master.zip                                                                                                         100% 3571KB   3.5MB/s   00:00    
strong@foreverstrong:~/Desktop/download$

1.3. 将远程目录拷贝到本地

strong@foreverstrong:~$ scp -r yongqiang@***.***.***.***:/home/yongqiang/Downloads /home/strong/Desktop/download/
yongqiang@***.***.***.***'s password: 
darknet-master.zip                                                                                                                       100% 3571KB   3.5MB/s   00:01    
strong@foreverstrong:~$
or
strong@foreverstrong:~/Desktop/download$ scp -r yongqiang@***.***.***.***:/home/yongqiang/Downloads ./
yongqiang@***.***.***.***'s password: 
darknet-master.zip                                                                                                         100% 3571KB   3.5MB/s   00:01    
strong@foreverstrong:~/Desktop/download$ ll
total 12
drwxrwxr-x 3 strong strong 4096 May 27 12:10 ./
drwxr-xr-x 7 strong strong 4096 May 27 11:37 ../
drwxr-xr-x 2 strong strong 4096 May 27 12:10 Downloads/
strong@foreverstrong:~/Desktop/download$

References

[1] Yongqiang Cheng, https://yongqiang.blog.csdn.net/

http://www.lryc.cn/news/338236.html

相关文章:

  • Java面试题:什么是Java的值传递和引用传递?列举其应用场景,并说明其特点
  • Java 基于微信小程序的智能停车场管理小程序
  • python基础——类型注解【变量,函数,Union】
  • 人工智能研究生前置知识—科学计算库numpy
  • element UI 设置type=“textarea“ 禁止输入框缩放
  • Rust腐蚀服务器常用参数设定详解
  • 无人机巡检技术革命性变革光伏电站运维管理
  • 【学习】软件信创测试中,如何做好兼容性适配
  • 阿里云ACK k8s集群迁移
  • 1.3 字符设备驱动
  • 计算机毕业设计springboot小区物业报修管理系统m8x57
  • 深度学习体系结构——CNN, RNN, GAN, Transformers, Encoder-Decoder Architectures算法原理与应用
  • js 数字的常用方法梳理
  • STM32H743VIT6使用STM32CubeMX通过I2S驱动WM8978(5)
  • Objective-C学习笔记(block,协议)4.10
  • AD7982BRMZRL7 二进制 500kSPS 模数转换芯片 ADI
  • 采集某新闻网资讯网站保存PDF
  • 03攻防世界-unserialize3
  • 蓝桥杯备考随手记: 常见的二维数组问题
  • Java | Leetcode Java题解之第28题找出字符串中第一个匹配项的下标
  • 【数据结构与算法】:二叉树经典OJ
  • uniapp——长按识别二维码
  • 云服务器环境web环境搭建之JDK、redis、mysql
  • 第1章 计算机网络体系结构
  • Docker之自定义镜像上传至阿里云
  • 《深入Linux内核架构》第2章 进程管理和调度 (2)
  • (四)PostgreSQL的psql命令
  • 前端使用minio传输文件
  • [大模型] BlueLM-7B-Chat WebDemo 部署
  • 一文了解ERC404协议