如果源路径有超过 8 个子目录级别,如何从远程 Windows SCP 到主机 Linux?

如果源路径有超过 8 个子目录级别,如何从远程 Windows SCP 到主机 Linux?

我有一台内置有 openssh 服务器的远程 Windows 机器。我尝试将远程 Windows 中scp名为“我的主目录”的文件夹复制到本地下载:0

scp -r micro:0 Downloads/

本地主机中的结果:

Downloads/0

然后我10远程窗口中添加了子文件夹并scp再次运行。本地主机中的结果:

Downloads/0
└── 1

我继续添加子文件夹,直到7。本地主机中的结果:

Downloads/0
└── 1
    └── 2
        └── 3
            └── 4
                └── 5
                    └── 6
                        └── 7

然后我添加了第 8 级。scp命令失败,没有创建8文件夹。输出:

Executing: program /usr/bin/ssh host micro, user (unspecified), command scp -v -r -f 0
OpenSSH_8.4p1 Ubuntu-5ubuntu1.1, OpenSSL 1.1.1j  16 Feb 2021
debug1: Reading configuration data /home/ali/.ssh/config
debug1: /home/ali/.ssh/config line 45: Applying options for micro
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files
debug1: /etc/ssh/ssh_config line 21: Applying options for *
debug1: Connecting to micro [192.168.1.178] port 22.
debug1: Connection established.
debug1: identity file /home/ali/.ssh/ali type 0
debug1: identity file /home/ali/.ssh/ali-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.4p1 Ubuntu-5ubuntu1.1
debug1: Remote protocol version 2.0, remote software version OpenSSH_for_Windows_8.1
debug1: match: OpenSSH_for_Windows_8.1 pat OpenSSH* compat 0x04000000
debug1: Authenticating to micro:22 as 'ali'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: [email protected] MAC: <implicit> compression: none
debug1: kex: client->server cipher: [email protected] MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ******
debug1: Host 'micro' is known and matches the ECDSA host key.
debug1: Found key in /home/ali/.ssh/known_hosts:11
debug1: rekey out after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey in after 134217728 blocks
debug1: Will attempt key: /home/ali/.ssh/ali RSA SHA256:****** explicit agent
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Next authentication method: publickey
debug1: Offering public key: /home/ali/.ssh/ali RSA SHA256:****** explicit agent
debug1: Server accepts key: /home/ali/.ssh/ali RSA SHA256:****** explicit agent
debug1: Authentication succeeded (publickey).
Authenticated to micro ([192.168.1.178]:22).
debug1: channel 0: new [client-session]
debug1: Requesting [email protected]
debug1: Entering interactive session.
debug1: pledge: network
debug1: client_input_global_request: rtype [email protected] want_reply 0
debug1: Sending environment.
debug1: Sending env LANG = en_US.UTF-8
debug1: Sending command: scp -v -r -f 0
Entering directory: D0777 0 0
Sink: D0777 0 0
Entering directory: D0777 0 1
Sink: D0777 0 1
Entering directory: D0777 0 2
Sink: D0777 0 2
Entering directory: D0777 0 3
Sink: D0777 0 3
Entering directory: D0777 0 4
Sink: D0777 0 4
Entering directory: D0777 0 5
Sink: D0777 0 5
Entering directory: D0777 0 6
Sink: D0777 0 6
Entering directory: D0777 0 7
Sink: D0777 0 7
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug1: channel 0: free: client-session, nchannels 1
debug1: fd 0 clearing O_NONBLOCK
Transferred: sent 3044, received 3552 bytes, in 2.2 seconds
Bytes per second: sent 1387.7, received 1619.3
debug1: Exit status -1073741571

这个问题似乎与长文件路径无关。我尝试移动0~/a/b/c/d/e/f/g/h/远程,scp -r micro:a/b/c/d/e/f/g/h/0 Downloads/没有文件夹也能正常工作8

如何scp在源路径下使用超过 8 个子目录级别?

答案1

这是你的错误信息:

debug1: Exit status -1073741571

错误代码-1073741571是十六进制错误代码 0xC00000FD 的有符号十进制表示,在 Windows 中代表堆栈溢出或堆栈耗尽。这通常发生在递归太深且程序的堆栈太小时。

问题是问题出在服务器上还是客户端上。

我认为您在远程服务器上使用了 Windows 内置应用程序。我建议用 OpenSSH 服务器替换它。

如果问题消失,你就知道问题出在服务器上,现在已经解决了。如果没有消失,那么你需要更换客户端软件。

相关内容