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

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

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

file /etc/ssh/ssh_config

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

2、查看是否安装ssh服务器
file /etc/ssh/sshd_config

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

3、根据情况安装客户端和服务器
// 安装客户端
sudo apt-get install openssh-clients

// 安装服务器
sudo apt-get install openssh-server
4、查看客户端、服务器是否开启
sudo systemctl is-enabled ssh

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

(如果没有开启的话)

sudo systemctl restart ssh

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

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

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

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

scp sz@10.33.23.93:/home/share/1.txt . 

Logo

DAMO开发者矩阵,由阿里巴巴达摩院和中国互联网协会联合发起,致力于探讨最前沿的技术趋势与应用成果,搭建高质量的交流与分享平台,推动技术创新与产业应用链接,围绕“人工智能与新型计算”构建开放共享的开发者生态。

更多推荐