ubuntu下通过ssh在两台计算机之间拷贝文件

参考:Linux 远程连接之 SSH 新手指南 - 知乎 (zhihu.com)

1、查看是否安装ssh客户端

(ubuntu下一般默认都安装了)

bash 复制代码
file /etc/ssh/ssh_config

有回复则表示安装了,否则会回复"No such file or directory"

2、查看是否安装ssh服务器
bash 复制代码
file /etc/ssh/sshd_config

有回复则表示安装了,否则会回复"No such file or directory"

3、根据情况安装客户端和服务器
bash 复制代码
// 安装客户端
sudo dnf install openssh-clients

// 安装服务器
sudo dnf install openssh-server
4、查看客户端、服务器是否开启
bash 复制代码
sudo systemctl is-enabled ssh

sudo systemctl is-enabled sshd
5、重启客户端、服务器

(如果没有开启的话)

bash 复制代码
sudo systemctl restart ssh

sudo systemctl restart sshd
6、拷贝文件
1)把当前目录下的1.txt文件拷贝到远程计算机

(计算机用户名为sz,ip地址为10.33.23.93,拷贝到位置/home/share文件夹下)

bash 复制代码
scp  1.txt sz@10.33.23.93:/home/share
2)从远程计算机拷贝文件到当前目录下

(计算机用户名为sz,ip地址为10.33.23.93,拷贝/home/share文件夹下的1.txt到当前目录下)

bash 复制代码
scp sz@10.33.23.93:/home/share/1.txt . 
相关推荐
一位摩羯座DBA33 分钟前
Redhat&Centos挂载镜像
linux·运维·centos
学习3人组33 分钟前
CentOS配置网络
linux·网络·centos
weixin_307779131 小时前
Hive集群之间迁移的Linux Shell脚本
大数据·linux·hive·bash·迁移学习
漫步企鹅2 小时前
【蓝牙】Linux Qt4查看已经配对的蓝牙信息
linux·qt·蓝牙·配对
cui_win2 小时前
【网络】Linux 内核优化实战 - net.core.flow_limit_table_len
linux·运维·网络
梦在深巷、2 小时前
MySQL/MariaDB数据库主从复制之基于二进制日志的方式
linux·数据库·mysql·mariadb
冰橙子id2 小时前
linux系统安全
linux·安全·系统安全
stark张宇2 小时前
VMware 虚拟机装 Linux Centos 7.9 保姆级教程(附资源包)
linux·后端
Johny_Zhao3 小时前
Ubuntu系统安装部署Pandawiki智能知识库
linux·mysql·网络安全·信息安全·云计算·shell·yum源·系统运维·itsm·pandawiki
悲伤小伞3 小时前
linux_git的使用
linux·c语言·c++·git