Linux 之间通过 SSH 传输文件

1.Linux传到Linux

使用scr命令

python 复制代码
scp source_file username@destination_host:/path/to/destination

source_file 是要传输的文件的路径。
username 是目标 Linux 主机上的用户名。
destination_host 是目标 Linux 主机的 IP 地址或主机名。
/path/to/destination 是目标 Linux 主机上的目标路径。

2.Windows传到Linux

确保 Windows 系统上已经安装了 OpenSSH 客户端。

在 Windows 10 的较新版本中,可以通过"设置"应用程序中的"可选功能"启用 OpenSSH 客户端。如果未安装,请先安装。

打开命令提示符或 PowerShell。您可以按下 Win + R,输入 cmd 或 powershell,然后按回车键。

使用 scp 命令传输文件。语法如下:

python 复制代码
scp local_file username@remote_host:/path/to/destination

local_file 是要传输的本地文件的路径。
username 是您在 Linux 主机上的用户名。
remote_host 是 Linux 主机的 IP 地址或主机名。
/path/to/destination 是 Linux 主机上目标目录的路径。

相关推荐
SundayBear2 分钟前
Linux驱动开发指南
linux·驱动开发·嵌入式
大聪明-PLUS3 分钟前
使用 GitLab CI/CD 为 Linux 构建 RPM 包(二)
linux·嵌入式·arm·smarc
yugi98783822 分钟前
C语言多进程创建和回收
linux·c语言·算法
鸠摩智首席音效师28 分钟前
如何在 Bash 命令中执行命令 (嵌套命令) ?
linux·bash
Bella的成长园地32 分钟前
Linux 中sudo bash -i 和 su root 有什么区别?
linux·运维·bash
matrixlzp1 小时前
Jenkins 实战3:Jenkins + habor + docker 自动化部署
运维·jenkins
vortex52 小时前
Linux 用户管理详解:从古老Unix到现代集成
linux·运维·unix
无敌最俊朗@2 小时前
C++ Opencv 蓝图01(进阶版)
linux·windows
玩转测试开发3 小时前
xshell设置跳板机登录内网服务器
运维·服务器·数据库
omnibots3 小时前
瑞萨SDK编译linux时,make menuconfig报错
linux·服务器·前端·嵌入式硬件