如何在Linux之间复制文件及文件夹

来自YTYZX有图有真相的百科
45.77.171.9讨论2022年3月22日 (二) 22:24的版本 (e)
跳转至: 导航搜索

e

e

故障排除

24.输入“scp root@192.168.1.105:/tmp/scptest.txt /tmp/scptest.txt”命令并按回车键确定提示“-bash: scp: command not found”。
     注意:此错误由未安装openssh引起。

SCP12.png

25.在CentOS/RHEL或者Fedora系统输入“yum install openssh-clients”并按回车键安装。
     注意:此处为openssh-clients。

SCP13.png

26.输入“y”即可开始安装。

SCP14.png

27.安装完毕后输入“service sshd status”查看sshd服务状态。

SCP15.png

28.在Ubuntu或者Debian系统下需输入“apt-get install openssh-client”并按回车键安装(本例中B主机已安装)。
     注意:此处为openssh-client,在client后面没有s。

SCP16.png

29.输入“service ssh start”启动ssh服务。
     注意:此处服务名为ssh,不是sshd。

SCP17.png

30.输入“scp root@192.168.1.105:/tmp/scptest.txt /tmp/scptest.txt”并按回车键确定,出现如下错误,则需在A主机和B主机上启动ssh或者sshd服务。
    错误提示:ssh: connect to host 192.168.1.105 port 22: Connection refused
    注意:使用scp命令需确保A主机和B主机均已启动ssh或者sshd服务。
              在CentOS/RHEL或者Fedora系统输入“service sshd start”或“systemctl start sshd”启动服务。
              在Ubuntu或者Debian系统下需输入“service ssh start”启动服务。

SCP30.png