可以使用 WinSCP 传输文件,但 scp 或 rsync 失败并出现“连接已关闭”等错误

可以使用 WinSCP 传输文件,但 scp 或 rsync 失败并出现“连接已关闭”等错误

当我尝试使用scp或传输文件时出现错误rsync,但我可以使用 WinSCP 传输文件,它使用 SCP 协议。

我在 Windows 11 和 WSL2 上运行 WinSCP scp rsync,当我在 Windows 上运行它们时,输出与此相同。

当我使用scp

$ scp foo [email protected]:~/
scp: Connection closed

当我使用rsync

$ rsync -av foo [email protected]:~/
sending incremental file list
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at io.c(231) [sender=3.2.7]

这是 WinSCP 的日志:

. 2024-02-17 17:28:40.385 --------------------------------------------------------------------------
. 2024-02-17 17:28:40.385 WinSCP 版本6.3 (构建版本 14793 2024-02-14) (OS 10.0.26052 – Windows 10 Enterprise)
. 2024-02-17 17:28:40.385 Configuration: HKCU\Software\Martin Prikryl\WinSCP 2\
. 2024-02-17 17:28:40.385 Log level: Normal
. 2024-02-17 17:28:40.385 Local account: LIHAOZE\Chumeng
. 2024-02-17 17:28:40.385 Working directory: C:\Program Files (x86)\WinSCP
. 2024-02-17 17:28:40.385 Process ID: 36348
. 2024-02-17 17:28:40.385 Ancestor processes: explorer, ...
. 2024-02-17 17:28:40.385 Command-line: "C:\Program Files (x86)\WinSCP\WinSCP.exe" 
. 2024-02-17 17:28:40.385 Time zone: Current: GMT+8 (中国标准时间), No DST
. 2024-02-17 17:28:40.385 Login time: 2024年2月17日 17:28:40
. 2024-02-17 17:28:40.385 --------------------------------------------------------------------------
. 2024-02-17 17:28:40.385 Session name: [email protected] (Modified site)
. 2024-02-17 17:28:40.385 Host name: 192.168.50.125 (Port: 22)
. 2024-02-17 17:28:40.385 User name: root (Password: Yes, Key file: No, Passphrase: No)
. 2024-02-17 17:28:40.385 Tunnel: No
. 2024-02-17 17:28:40.385 Transfer Protocol: SCP
. 2024-02-17 17:28:40.385 Ping type: Off, Ping interval: 30 sec; Timeout: 15 sec
. 2024-02-17 17:28:40.385 Disable Nagle: No
. 2024-02-17 17:28:40.385 Proxy: None
. 2024-02-17 17:28:40.385 Send buffer: 262144
. 2024-02-17 17:28:40.385 Compression: No
. 2024-02-17 17:28:40.385 Bypass authentication: No
. 2024-02-17 17:28:40.385 Try agent: Yes; Agent forwarding: No; KI: Yes; GSSAPI: Yes
. 2024-02-17 17:28:40.385 GSSAPI: KEX: No; Forwarding: No; Libs: gssapi32,sspi,custom; Custom: 
. 2024-02-17 17:28:40.385 Ciphers: aes,chacha20,aesgcm,3des,WARN,des,blowfish,arcfour; Ssh2DES: No
. 2024-02-17 17:28:40.385 KEX: ntru-curve25519,ecdh,dh-gex-sha1,dh-group18-sha512,dh-group17-sha512,dh-group16-sha512,dh-group15-sha512,dh-group14-sha1,rsa,WARN,dh-group1-sha1
. 2024-02-17 17:28:40.385 SSH Bugs: Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto
. 2024-02-17 17:28:40.385 Simple channel: Yes
. 2024-02-17 17:28:40.385 Return code variable: Autodetect; Lookup user groups: Auto
. 2024-02-17 17:28:40.385 Shell: /bin/bash
. 2024-02-17 17:28:40.385 EOL: LF, UTF: Auto
. 2024-02-17 17:28:40.385 Clear aliases: Yes, Unset nat.vars: Yes, Resolve symlinks: Yes; Follow directory symlinks: No
. 2024-02-17 17:28:40.385 LS: ls -la, Ign LS warn: Yes, Scp1 Comp: No; Exit code 1 is error: No
. 2024-02-17 17:28:40.385 Local directory: C:\Users\25952\Desktop, Remote directory: /root, Update: Yes, Cache: Yes
. 2024-02-17 17:28:40.385 Cache directory changes: Yes, Permanent: Yes
. 2024-02-17 17:28:40.385 Recycle bin: Delete to: No, Overwritten to: No, Bin path: 
. 2024-02-17 17:28:40.385 DST mode: Unix;Timezone offset: 0h 0m
. 2024-02-17 17:28:40.385 --------------------------------------------------------------------------
. 2024-02-17 17:28:40.460 Looking up host "192.168.50.125" for SSH connection
. 2024-02-17 17:28:40.460 Connecting to 192.168.50.125 port 22
. 2024-02-17 17:28:40.461 Connected to 192.168.50.125
. 2024-02-17 17:28:40.510 We claim version: SSH-2.0-WinSCP_release_6.3
. 2024-02-17 17:28:40.510 Connected to 192.168.50.125
. 2024-02-17 17:28:40.556 Remote version: SSH-2.0-OpenSSH_8.2
. 2024-02-17 17:28:40.556 Using SSH protocol version 2
. 2024-02-17 17:28:40.556 Have a known host key of type ssh-ed25519
. 2024-02-17 17:28:40.558 Doing ECDH key exchange with curve Curve25519, using hash SHA-256
. 2024-02-17 17:28:40.614 Server also has ecdsa-sha2-nistp256/rsa-sha2-512/rsa-sha2-256/ssh-rsa host keys, but we don't know any of them
. 2024-02-17 17:28:40.614 Host key fingerprint is:
. 2024-02-17 17:28:40.614 ssh-ed25519 255 SHA256:1Xrnx35***
. 2024-02-17 17:28:40.634 Host key matches cached key
. 2024-02-17 17:28:40.635 Initialised AES-256 SDCTR (AES-NI accelerated) [aes256-ctr] outbound encryption
. 2024-02-17 17:28:40.635 Initialised HMAC-SHA-256 outbound MAC algorithm
. 2024-02-17 17:28:40.635 Initialised AES-256 SDCTR (AES-NI accelerated) [aes256-ctr] inbound encryption
. 2024-02-17 17:28:40.635 Initialised HMAC-SHA-256 inbound MAC algorithm
! 2024-02-17 17:28:40.636 Using username "root".
. 2024-02-17 17:28:40.655 Server offered these authentication methods: publickey,password
. 2024-02-17 17:28:40.655 Prompt (password, "SSH password", <no instructions>, "密码(&P):")
. 2024-02-17 17:28:40.655 Using stored password.
. 2024-02-17 17:28:40.667 Sent password
. 2024-02-17 17:28:40.832 Access granted
. 2024-02-17 17:28:40.832 Opening main session channel
. 2024-02-17 17:28:40.887 Opened main channel
. 2024-02-17 17:28:40.888 Started a shell/command
. 2024-02-17 17:28:40.919 --------------------------------------------------------------------------
. 2024-02-17 17:28:40.919 Using SCP protocol.
. 2024-02-17 17:28:40.920 Doing startup conversation with host.
. 2024-02-17 17:28:40.936 Skipping host startup message (if any).
> 2024-02-17 17:28:40.936 echo "WinSCP: this is end-of-file:0"
< 2024-02-17 17:28:40.951 WinSCP: this is end-of-file:0
. 2024-02-17 17:28:40.952 Detecting variable containing return code of last command.
. 2024-02-17 17:28:40.952 Trying "$status".
> 2024-02-17 17:28:40.952 echo "$status" ; echo "WinSCP: this is end-of-file:0"
< 2024-02-17 17:28:40.952 WinSCP: this is end-of-file:0
. 2024-02-17 17:28:40.952 The response is not numerical exit code
. 2024-02-17 17:28:40.952 Trying "$?".
> 2024-02-17 17:28:40.952 echo "$?" ; echo "WinSCP: this is end-of-file:0"
< 2024-02-17 17:28:40.953 0
< 2024-02-17 17:28:40.953 WinSCP: this is end-of-file:0
. 2024-02-17 17:28:40.953 Return code variable "$?" selected.
> 2024-02-17 17:28:40.953 printenv LANG ; echo "WinSCP: this is end-of-file:$?"
< 2024-02-17 17:28:40.966 WinSCP: this is end-of-file:1
. 2024-02-17 17:28:40.966 We will not use UTF-8
. 2024-02-17 17:28:40.966 Clearing all aliases.
> 2024-02-17 17:28:40.966 unalias "ls" ; echo "WinSCP: this is end-of-file:$?"
! 2024-02-17 17:28:40.967 /bin/bash: line 5: unalias: ls: not found
< 2024-02-17 17:28:40.967 WinSCP: this is end-of-file:1
> 2024-02-17 17:28:40.967 unalias "echo" ; echo "WinSCP: this is end-of-file:$?"
! 2024-02-17 17:28:40.968 /bin/bash: line 6: unalias: echo: not found
< 2024-02-17 17:28:40.968 WinSCP: this is end-of-file:1
> 2024-02-17 17:28:40.968 unalias "pwd" ; echo "WinSCP: this is end-of-file:$?"
! 2024-02-17 17:28:40.969 /bin/bash: line 7: unalias: pwd: not found
< 2024-02-17 17:28:40.969 WinSCP: this is end-of-file:1
> 2024-02-17 17:28:40.969 unalias "cd" ; echo "WinSCP: this is end-of-file:$?"
! 2024-02-17 17:28:40.969 /bin/bash: line 8: unalias: cd: not found
< 2024-02-17 17:28:40.969 WinSCP: this is end-of-file:1
> 2024-02-17 17:28:40.969 unalias "groups" ; echo "WinSCP: this is end-of-file:$?"
! 2024-02-17 17:28:40.970 /bin/bash: line 9: unalias: groups: not found
< 2024-02-17 17:28:40.970 WinSCP: this is end-of-file:1
> 2024-02-17 17:28:40.970 unalias "scp" ; echo "WinSCP: this is end-of-file:$?"
! 2024-02-17 17:28:40.970 /bin/bash: line 10: unalias: scp: not found
< 2024-02-17 17:28:40.970 WinSCP: this is end-of-file:1
> 2024-02-17 17:28:40.971 unalias "rm" ; echo "WinSCP: this is end-of-file:$?"
! 2024-02-17 17:28:40.971 /bin/bash: line 11: unalias: rm: not found
< 2024-02-17 17:28:40.971 WinSCP: this is end-of-file:1
> 2024-02-17 17:28:40.971 unalias "mv" ; echo "WinSCP: this is end-of-file:$?"
! 2024-02-17 17:28:40.971 /bin/bash: line 12: unalias: mv: not found
< 2024-02-17 17:28:40.972 WinSCP: this is end-of-file:1
> 2024-02-17 17:28:40.972 unalias "mkdir" ; echo "WinSCP: this is end-of-file:$?"
! 2024-02-17 17:28:40.972 /bin/bash: line 13: unalias: mkdir: not found
< 2024-02-17 17:28:40.972 WinSCP: this is end-of-file:1
> 2024-02-17 17:28:40.972 unalias "chmod" ; echo "WinSCP: this is end-of-file:$?"
! 2024-02-17 17:28:40.973 /bin/bash: line 14: unalias: chmod: not found
< 2024-02-17 17:28:40.973 WinSCP: this is end-of-file:1
> 2024-02-17 17:28:40.973 unalias "chgrp" ; echo "WinSCP: this is end-of-file:$?"
! 2024-02-17 17:28:40.973 /bin/bash: line 15: unalias: chgrp: not found
< 2024-02-17 17:28:40.973 WinSCP: this is end-of-file:1
> 2024-02-17 17:28:40.973 unalias "chown" ; echo "WinSCP: this is end-of-file:$?"
! 2024-02-17 17:28:40.974 /bin/bash: line 16: unalias: chown: not found
< 2024-02-17 17:28:40.974 WinSCP: this is end-of-file:1
> 2024-02-17 17:28:40.974 unalias "unset" ; echo "WinSCP: this is end-of-file:$?"
! 2024-02-17 17:28:40.974 /bin/bash: line 17: unalias: unset: not found
< 2024-02-17 17:28:40.975 WinSCP: this is end-of-file:1
> 2024-02-17 17:28:40.975 unalias "unalias" ; echo "WinSCP: this is end-of-file:$?"
! 2024-02-17 17:28:40.975 /bin/bash: line 18: unalias: unalias: not found
< 2024-02-17 17:28:40.975 WinSCP: this is end-of-file:1
> 2024-02-17 17:28:40.975 unalias "ln" ; echo "WinSCP: this is end-of-file:$?"
! 2024-02-17 17:28:40.975 /bin/bash: line 19: unalias: ln: not found
< 2024-02-17 17:28:40.975 WinSCP: this is end-of-file:1
> 2024-02-17 17:28:40.975 unalias "cp" ; echo "WinSCP: this is end-of-file:$?"
! 2024-02-17 17:28:40.977 /bin/bash: line 20: unalias: cp: not found
< 2024-02-17 17:28:40.977 WinSCP: this is end-of-file:1
> 2024-02-17 17:28:40.977 unalias "printenv" ; echo "WinSCP: this is end-of-file:$?"
! 2024-02-17 17:28:40.977 /bin/bash: line 21: unalias: printenv: not found
< 2024-02-17 17:28:40.977 WinSCP: this is end-of-file:1
. 2024-02-17 17:28:40.977 Clearing national user variables.
> 2024-02-17 17:28:40.977 unset "LANG" ; echo "WinSCP: this is end-of-file:$?"
< 2024-02-17 17:28:40.977 WinSCP: this is end-of-file:0
> 2024-02-17 17:28:40.977 unset "LANGUAGE" ; echo "WinSCP: this is end-of-file:$?"
< 2024-02-17 17:28:40.978 WinSCP: this is end-of-file:0
> 2024-02-17 17:28:40.978 unset "LC_CTYPE" ; echo "WinSCP: this is end-of-file:$?"
< 2024-02-17 17:28:40.979 WinSCP: this is end-of-file:0
> 2024-02-17 17:28:40.979 unset "LC_COLLATE" ; echo "WinSCP: this is end-of-file:$?"
< 2024-02-17 17:28:40.979 WinSCP: this is end-of-file:0
> 2024-02-17 17:28:40.979 unset "LC_MONETARY" ; echo "WinSCP: this is end-of-file:$?"
< 2024-02-17 17:28:40.980 WinSCP: this is end-of-file:0
> 2024-02-17 17:28:40.980 unset "LC_NUMERIC" ; echo "WinSCP: this is end-of-file:$?"
< 2024-02-17 17:28:40.980 WinSCP: this is end-of-file:0
> 2024-02-17 17:28:40.980 unset "LC_TIME" ; echo "WinSCP: this is end-of-file:$?"
< 2024-02-17 17:28:40.980 WinSCP: this is end-of-file:0
> 2024-02-17 17:28:40.980 unset "LC_MESSAGES" ; echo "WinSCP: this is end-of-file:$?"
< 2024-02-17 17:28:40.981 WinSCP: this is end-of-file:0
> 2024-02-17 17:28:40.981 unset "LC_ALL" ; echo "WinSCP: this is end-of-file:$?"
< 2024-02-17 17:28:40.981 WinSCP: this is end-of-file:0
> 2024-02-17 17:28:40.981 unset "HUMAN_BLOCKS" ; echo "WinSCP: this is end-of-file:$?"
< 2024-02-17 17:28:40.981 WinSCP: this is end-of-file:0
> 2024-02-17 17:28:40.981 unset "BLOCK_SIZE" ; echo "WinSCP: this is end-of-file:$?"
< 2024-02-17 17:28:40.982 WinSCP: this is end-of-file:0
> 2024-02-17 17:28:40.982 unset "LS_BLOCK_SIZE" ; echo "WinSCP: this is end-of-file:$?"
< 2024-02-17 17:28:40.982 WinSCP: this is end-of-file:0
. 2024-02-17 17:28:40.982 Looking up groups and users.
> 2024-02-17 17:28:40.982 groups ; echo "WinSCP: this is end-of-file:$?"
< 2024-02-17 17:28:40.985 root daemon log
< 2024-02-17 17:28:40.985 WinSCP: this is end-of-file:0
. 2024-02-17 17:28:40.987 Following groups found:
. 2024-02-17 17:28:40.987   "root" [0]
. 2024-02-17 17:28:40.987   "daemon" [0]
. 2024-02-17 17:28:40.987   "log" [0]
. 2024-02-17 17:28:40.987 Following membership found:
. 2024-02-17 17:28:40.987   "root" [0]
. 2024-02-17 17:28:40.987   "daemon" [0]
. 2024-02-17 17:28:40.987   "log" [0]
. 2024-02-17 17:28:40.987 No users found.
. 2024-02-17 17:28:40.987 Changing directory to "/root".
> 2024-02-17 17:28:40.987 cd "/root" ; echo "WinSCP: this is end-of-file:$?"
< 2024-02-17 17:28:40.987 WinSCP: this is end-of-file:0
. 2024-02-17 17:28:40.987 Getting current directory name.
> 2024-02-17 17:28:40.987 pwd ; echo "WinSCP: this is end-of-file:$?"
< 2024-02-17 17:28:40.988 /root
< 2024-02-17 17:28:40.988 WinSCP: this is end-of-file:0
. 2024-02-17 17:28:41.058 Listing current directory.
> 2024-02-17 17:28:41.058 ls -la --full-time ; echo "WinSCP: this is end-of-file:$?"
< 2024-02-17 17:28:41.069 total 52
< 2024-02-17 17:28:41.069 drwx------  4 root root 4096 2024-02-17 17:12:38.301898164 +0800 .
< 2024-02-17 17:28:41.069 drwxrwxr-x 23 root root 4096 2018-10-20 16:42:48.000000000 +0800 ..
< 2024-02-17 17:28:41.069 -rw-------  1 root root    5 2024-02-17 17:12:38.301898164 +0800 .bash_history
< 2024-02-17 17:28:41.069 drwx------  3 root root 4096 2024-02-17 17:03:01.149215975 +0800 .config
< 2024-02-17 17:28:41.069 -rw-r--r--  1 root root 1399 2024-02-17 13:18:01.570000000 +0800 .profile
< 2024-02-17 17:28:41.069 -rw-r--r--  1 root root 2043 2022-06-22 13:47:14.000000000 +0800 .profile.size_check
< 2024-02-17 17:28:41.069 drwx------  2 root root 4096 2024-02-17 13:40:30.973639174 +0800 .ssh
< 2024-02-17 17:28:41.069 -rw-------  1 root root 8940 2024-02-17 13:45:36.870321628 +0800 .viminfo
< 2024-02-17 17:28:41.069 -rw-r--r--  1 root root  232 2024-02-17 13:23:10.286012000 +0800 .wget-hsts
< 2024-02-17 17:28:41.074 -rwx------  1 root root  936 2016-06-20 03:12:00.000000000 +0800 buildroot-armeabihf-bootstrap.sh
< 2024-02-17 17:28:41.074 WinSCP: this is end-of-file:0
. 2024-02-17 17:28:41.074 Directory listing with --full-time succeed, next time all errors during directory listing will be displayed immediately.
. 2024-02-17 17:28:41.074 ..;d;0;2018-10-20T08:42:48.000Z;4;"root" [0];"root" [0];rwxrwxr-x;0
. 2024-02-17 17:28:41.074 .bash_history;-;5;2024-02-17T09:12:38.000Z;4;"root" [0];"root" [0];rw-------;2
. 2024-02-17 17:28:41.074 .config;d;0;2024-02-17T09:03:01.000Z;4;"root" [0];"root" [0];rwx------;2
. 2024-02-17 17:28:41.074 .profile;-;1399;2024-02-17T05:18:01.000Z;4;"root" [0];"root" [0];rw-r--r--;2
. 2024-02-17 17:28:41.074 .profile.size_check;-;2043;2022-06-22T05:47:14.000Z;4;"root" [0];"root" [0];rw-r--r--;2
. 2024-02-17 17:28:41.074 .ssh;d;0;2024-02-17T05:40:30.000Z;4;"root" [0];"root" [0];rwx------;2
. 2024-02-17 17:28:41.074 .viminfo;-;8940;2024-02-17T05:45:36.000Z;4;"root" [0];"root" [0];rw-------;2
. 2024-02-17 17:28:41.074 .wget-hsts;-;232;2024-02-17T05:23:10.000Z;4;"root" [0];"root" [0];rw-r--r--;2
. 2024-02-17 17:28:41.074 buildroot-armeabihf-bootstrap.sh;-;936;2016-06-19T19:12:00.000Z;4;"root" [0];"root" [0];rwx------;0
. 2024-02-17 17:28:41.105 Startup conversation with host finished.

以下是scp的详细输出:

Executing: program /usr/bin/ssh host 192.168.50.125, user root, command sftp
OpenSSH_9.6p1, OpenSSL 3.2.1 30 Jan 2024
debug1: Reading configuration data /home/chumeng/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 2: include /etc/ssh/ssh_config.d/*.conf matched no files
debug2: resolve_canonicalize: hostname 192.168.50.125 is address
debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts' -> '/home/chumeng/.ssh/known_hosts'
debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts2' -> '/home/chumeng/.ssh/known_hosts2'
debug3: channel_clear_timeouts: clearing
debug3: ssh_connect_direct: entering
debug1: Connecting to 192.168.50.125 [192.168.50.125] port 22.
debug3: set_sock_tos: set socket 3 IP_TOS 0x48
debug1: Connection established.
debug1: identity file /home/chumeng/.ssh/id_rsa type -1
debug1: identity file /home/chumeng/.ssh/id_rsa-cert type -1
debug1: identity file /home/chumeng/.ssh/id_ecdsa type -1
debug1: identity file /home/chumeng/.ssh/id_ecdsa-cert type -1
debug1: identity file /home/chumeng/.ssh/id_ecdsa_sk type -1
debug1: identity file /home/chumeng/.ssh/id_ecdsa_sk-cert type -1
debug1: identity file /home/chumeng/.ssh/id_ed25519 type 3
debug1: identity file /home/chumeng/.ssh/id_ed25519-cert type -1
debug1: identity file /home/chumeng/.ssh/id_ed25519_sk type -1
debug1: identity file /home/chumeng/.ssh/id_ed25519_sk-cert type -1
debug1: identity file /home/chumeng/.ssh/id_xmss type -1
debug1: identity file /home/chumeng/.ssh/id_xmss-cert type -1
debug1: identity file /home/chumeng/.ssh/id_dsa type -1
debug1: identity file /home/chumeng/.ssh/id_dsa-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_9.6
debug1: Remote protocol version 2.0, remote software version OpenSSH_8.2
debug1: compat_banner: match: OpenSSH_8.2 pat OpenSSH* compat 0x04000000
debug2: fd 3 setting O_NONBLOCK
debug1: Authenticating to 192.168.50.125:22 as 'root'
debug3: record_hostkey: found key type ED25519 in file /home/chumeng/.ssh/known_hosts:4
debug3: record_hostkey: found key type ECDSA in file /home/chumeng/.ssh/known_hosts:5
debug3: load_hostkeys_file: loaded 2 keys from 192.168.50.125
debug1: load_hostkeys: fopen /home/chumeng/.ssh/known_hosts2: No such file or directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts: No such file or directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts2: No such file or directory
debug3: order_hostkeyalgs: have matching best-preference key type [email protected], using HostkeyAlgorithms verbatim
debug3: send packet: type 20
debug1: SSH2_MSG_KEXINIT sent
debug3: receive packet: type 20
debug1: SSH2_MSG_KEXINIT received
debug2: local client KEXINIT proposal
debug2: KEX algorithms: [email protected],curve25519-sha256,[email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256,ext-info-c,[email protected]
debug2: host key algorithms: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],ssh-ed25519,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,[email protected],[email protected],rsa-sha2-512,rsa-sha2-256
debug2: ciphers ctos: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected]
debug2: ciphers stoc: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected]
debug2: MACs ctos: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: MACs stoc: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: compression ctos: none,[email protected],zlib
debug2: compression stoc: none,[email protected],zlib
debug2: languages ctos:
debug2: languages stoc:
debug2: first_kex_follows 0
debug2: reserved 0
debug2: peer server KEXINIT proposal
debug2: KEX algorithms: curve25519-sha256,[email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256
debug2: host key algorithms: rsa-sha2-512,rsa-sha2-256,ssh-rsa,ecdsa-sha2-nistp256,ssh-ed25519
debug2: ciphers ctos: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected]
debug2: ciphers stoc: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected]
debug2: MACs ctos: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: MACs stoc: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: compression ctos: none,[email protected]
debug2: compression stoc: none,[email protected]
debug2: languages ctos:
debug2: languages stoc:
debug2: first_kex_follows 0
debug2: reserved 0
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ssh-ed25519
debug1: kex: server->client cipher: [email protected] MAC: <implicit> compression: none
debug1: kex: client->server cipher: [email protected] MAC: <implicit> compression: none
debug3: send packet: type 30
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug3: receive packet: type 31
debug1: SSH2_MSG_KEX_ECDH_REPLY received
debug1: Server host key: ssh-ed25519 SHA256:1Xrnx3588d2auPECftUxab5wJyhYbzXLKEFy63hNLHw
debug3: record_hostkey: found key type ED25519 in file /home/chumeng/.ssh/known_hosts:4
debug3: record_hostkey: found key type ECDSA in file /home/chumeng/.ssh/known_hosts:5
debug3: load_hostkeys_file: loaded 2 keys from 192.168.50.125
debug1: load_hostkeys: fopen /home/chumeng/.ssh/known_hosts2: No such file or directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts: No such file or directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts2: No such file or directory
debug1: Host '192.168.50.125' is known and matches the ED25519 host key.
debug1: Found key in /home/chumeng/.ssh/known_hosts:4
debug3: send packet: type 21
debug2: ssh_set_newkeys: mode 1
debug1: rekey out after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug3: receive packet: type 21
debug1: SSH2_MSG_NEWKEYS received
debug2: ssh_set_newkeys: mode 0
debug1: rekey in after 134217728 blocks
debug3: send packet: type 5
debug3: receive packet: type 7
debug1: SSH2_MSG_EXT_INFO received
debug3: kex_input_ext_info: extension server-sig-algs
debug1: kex_ext_info_client_parse: server-sig-algs=<ssh-ed25519,[email protected],ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,[email protected]>
debug3: receive packet: type 6
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug3: send packet: type 50
debug3: receive packet: type 51
debug1: Authentications that can continue: publickey,password
debug3: start over, passed a different list publickey,password
debug3: preferred publickey,keyboard-interactive,password
debug3: authmethod_lookup publickey
debug3: remaining preferred: keyboard-interactive,password
debug3: authmethod_is_enabled publickey
debug1: Next authentication method: publickey
debug1: Will attempt key: /home/chumeng/.ssh/id_rsa
debug1: Will attempt key: /home/chumeng/.ssh/id_ecdsa
debug1: Will attempt key: /home/chumeng/.ssh/id_ecdsa_sk
debug1: Will attempt key: /home/chumeng/.ssh/id_ed25519 ED25519 SHA256:qkvM48Pux1GSV3MXPw2ZR7SI1Th/5eWmZgbNiztzfWI
debug1: Will attempt key: /home/chumeng/.ssh/id_ed25519_sk
debug1: Will attempt key: /home/chumeng/.ssh/id_xmss
debug1: Will attempt key: /home/chumeng/.ssh/id_dsa
debug2: pubkey_prepare: done
debug1: Trying private key: /home/chumeng/.ssh/id_rsa
debug3: no such identity: /home/chumeng/.ssh/id_rsa: No such file or directory
debug1: Trying private key: /home/chumeng/.ssh/id_ecdsa
debug3: no such identity: /home/chumeng/.ssh/id_ecdsa: No such file or directory
debug1: Trying private key: /home/chumeng/.ssh/id_ecdsa_sk
debug3: no such identity: /home/chumeng/.ssh/id_ecdsa_sk: No such file or directory
debug1: Offering public key: /home/chumeng/.ssh/id_ed25519 ED25519 SHA256:qkvM48Pux1GSV3MXPw2ZR7SI1Th/5eWmZgbNiztzfWI
debug3: send packet: type 50
debug2: we sent a publickey packet, wait for reply
debug3: receive packet: type 60
debug1: Server accepts key: /home/chumeng/.ssh/id_ed25519 ED25519 SHA256:qkvM48Pux1GSV3MXPw2ZR7SI1Th/5eWmZgbNiztzfWI
debug3: sign_and_send_pubkey: using publickey with ED25519 SHA256:qkvM48Pux1GSV3MXPw2ZR7SI1Th/5eWmZgbNiztzfWI
debug3: sign_and_send_pubkey: signing using ssh-ed25519 SHA256:qkvM48Pux1GSV3MXPw2ZR7SI1Th/5eWmZgbNiztzfWI
debug3: send packet: type 50
debug3: receive packet: type 52
Authenticated to 192.168.50.125 ([192.168.50.125]:22) using "publickey".
debug2: fd 4 setting O_NONBLOCK
debug1: channel 0: new session [client-session] (inactive timeout: 0)
debug3: ssh_session2_open: channel_new: 0
debug2: channel 0: send open
debug3: send packet: type 90
debug1: Requesting [email protected]
debug3: send packet: type 80
debug1: Entering interactive session.
debug1: pledge: filesystem
debug3: client_repledge: enter
debug3: receive packet: type 80
debug1: client_input_global_request: rtype [email protected] want_reply 0
debug3: client_input_hostkeys: received RSA key SHA256:edXX5T+7pJn72YyU62suDGWHdUNSJF9qyzedmfJvTJU
debug3: client_input_hostkeys: received ECDSA key SHA256:6rvowhBnQNY5lS//9sGZGNE+K1jTSswKFvOVZAY0ilY
debug3: client_input_hostkeys: received ED25519 key SHA256:1Xrnx3588d2auPECftUxab5wJyhYbzXLKEFy63hNLHw
debug1: client_input_hostkeys: searching /home/chumeng/.ssh/known_hosts for 192.168.50.125 / (none)
debug3: hostkeys_foreach: reading file "/home/chumeng/.ssh/known_hosts"
debug3: hostkeys_find: found ssh-ed25519 key at /home/chumeng/.ssh/known_hosts:4
debug3: hostkeys_find: found ecdsa-sha2-nistp256 key at /home/chumeng/.ssh/known_hosts:5
debug1: client_input_hostkeys: searching /home/chumeng/.ssh/known_hosts2 for 192.168.50.125 / (none)
debug1: client_input_hostkeys: hostkeys file /home/chumeng/.ssh/known_hosts2 does not exist
debug3: client_input_hostkeys: 3 server keys: 1 new, 1 retained, 1 incomplete match. 0 to remove
debug3: client_input_hostkeys: asking server to prove ownership for 1 keys
debug3: send packet: type 80
debug3: receive packet: type 4
debug1: Remote: /root/.ssh/authorized_keys:1: key options: agent-forwarding port-forwarding pty user-rc x11-forwarding
debug3: receive packet: type 4
debug1: Remote: /root/.ssh/authorized_keys:1: key options: agent-forwarding port-forwarding pty user-rc x11-forwarding
debug3: receive packet: type 91
debug2: channel_input_open_confirmation: channel 0: callback start
debug2: fd 3 setting TCP_NODELAY
debug3: set_sock_tos: set socket 3 IP_TOS 0x20
debug2: client_session2_setup: id 0
debug1: Sending subsystem: sftp
debug2: channel 0: request subsystem confirm 1
debug3: send packet: type 98
debug3: client_repledge: enter
debug2: channel_input_open_confirmation: channel 0: callback done
debug2: channel 0: open confirm rwindow 0 rmax 32768
debug3: receive packet: type 81
debug1: client_global_hostkeys_prove_confirm: server used untrusted RSA signature algorithm ssh-rsa for key 0, disregarding
debug3: hostkeys_foreach: reading file "/home/chumeng/.ssh/known_hosts"
debug3: host_delete: ED25519 key already at /home/chumeng/.ssh/known_hosts:4
debug3: host_delete: ECDSA key already at /home/chumeng/.ssh/known_hosts:5
debug1: update_known_hosts: known hosts file /home/chumeng/.ssh/known_hosts2 does not exist
debug3: client_repledge: enter
debug1: pledge: fork
debug2: channel 0: rcvd adjust 2097152
debug3: receive packet: type 99
debug2: channel_input_status_confirm: type 99 id 0
debug2: subsystem request accepted on channel 0
debug3: receive packet: type 96
debug2: channel 0: rcvd eof
debug2: channel 0: output open -> drain
debug2: channel 0: obuf empty
debug2: chan_shutdown_write: channel 0: (i0 o1 sock -1 wfd 5 efd 6 [write])
debug2: channel 0: output drain -> closed
debug3: receive packet: type 98
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug3: receive packet: type 98
debug1: client_input_channel_req: channel 0 rtype [email protected] reply 0
debug2: channel 0: rcvd eow
debug2: chan_shutdown_read: channel 0: (i0 o3 sock -1 wfd 4 efd 6 [write])
debug2: channel 0: input open -> closed
debug3: receive packet: type 97
debug2: channel 0: rcvd close
debug3: channel 0: will not send data after close
debug2: channel 0: almost dead
debug2: channel 0: gc: notify user
debug2: channel 0: gc: user detached
debug2: channel 0: send close
debug3: send packet: type 97
debug2: channel 0: is dead
debug2: channel 0: garbage collecting
debug1: channel 0: free: client-session, nchannels 1
debug3: channel 0: status: The following connections are open:
  #0 client-session (t4 [session] r0 i3/0 o3/0 e[write]/0 fd -1/-1/6 sock -1 cc -1 io 0x00/0x00)

debug3: send packet: type 1
Transferred: sent 2548, received 2840 bytes, in 0.1 seconds
Bytes per second: sent 26685.8, received 29744.0
debug1: Exit status 255
scp: Connection closed

服务器机器是 Synology 218j。我可以确认我已在控制面板中启用了 SFTP 和 Rsync。

答案1

OpenSSH_9.6p1,OpenSSL 3.2.1 2024 年 1 月 30 日
...
debug1:发送子系统:sftp

您正在使用的最新版本scp,它默认内部使用 SFTP(而不是 SCP)。

您的服务器似乎不支持 SFTP 协议。

如果你想使用 SCP 协议scp,请添加-O转变到它的命令行:

scp -O foo [email protected]:~/

不过,请考虑修复您的服务器以支持 SFTP。

相关内容