Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/windows/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用SCP命令将文件/文件夹从windows复制到Linux PC_Linux_Windows_Scp - Fatal编程技术网

使用SCP命令将文件/文件夹从windows复制到Linux PC

使用SCP命令将文件/文件夹从windows复制到Linux PC,linux,windows,scp,Linux,Windows,Scp,我想将一些文件夹从Windows PC复制到Linux计算机。我正在使用Putty并连接到我的Linux PC。在Putty中,我执行了以下命令,试图将文件从Windows文件夹路径复制到Linux中的当前文件夹: scp -r user_name@IPAddr_Windows_PC:C:\Test\Folder . 我收到一个“连接被拒绝”错误。如果我使用的命令有任何错误,请告诉我。我需要正确的命令,因为我必须开发一个脚本。在linux机器上执行的scp命令假定目标机器上运行一个sshd守护

我想将一些文件夹从Windows PC复制到Linux计算机。我正在使用Putty并连接到我的Linux PC。在Putty中,我执行了以下命令,试图将文件从Windows文件夹路径复制到Linux中的当前文件夹:

scp -r user_name@IPAddr_Windows_PC:C:\Test\Folder .

我收到一个“连接被拒绝”错误。如果我使用的命令有任何错误,请告诉我。我需要正确的命令,因为我必须开发一个脚本。

在linux机器上执行的scp命令假定目标机器上运行一个sshd守护进程服务器,该服务器将打开端口22并侦听传入的ssh请求。linux中的文件传输子系统sftp(不知道Windows的等效项是什么)将由sshd守护进程启动以响应文件传输请求

连接被拒绝是由于Windows计算机上没有进程侦听端口22造成的

<>你可能应该考虑反向传输,就像上面的SCP建议一样。另一种选择是使用rsync。在Linux上,rsync是一种常用工具,对于Windows,您可以找到用Python编写的与rsync兼容的程序

rsync命令的外观如下所示:

rsync:/mydocuments/myfiles/my.linux.machine::myfiles


本例假设目标计算机上有一个rsync守护程序。

您可以使用Filezilla或类似的SFTP连接将文件从windows box传输到Linux。请使用。如果您使用PuTTY,那么您已经在服务器上,无法访问本地文件,除非您的Windows计算机上也有SSH守护程序。对于简单的用例,scp通常在源机器上执行,而不是在目标机器上执行。