User: (venv) root@PHK110:~# scp -P 13221 admin@127.0.0.1:/volueme1/L/win11专业精简版.esd /
admin@127.0.0.1's password:
subsystem request failed on channel 0
scp: Connection closed

啥意思
Assistant: 错误信息表明在使用 `scp` 进行文件传输时遇到了问题。具体来说，“subsystem request failed on channel 0”和“Connection closed”错误通常与以下原因有关：

1. **SSH 设置问题**: 目标机器上的 SSH 配置可能存在问题，尤其是与 SCP 或 SFTP 子系统有关的配置项可能不正确，检查 `/etc/ssh/sshd_config` 文件，确保存在类似 `Subsystem sftp /usr/lib/openssh/sftp-server` 的配置，并且该行未被注释掉。

2. **防火墙问题**: 防火墙设置可能阻止了端口 13221 的访问。确保服务器和你的机器之间的防火墙规则允许该端口的通信。

3. **用户权限**: 确认用于连接的用户（在此为 `admin`）对目标文件和路径有适当的权限。

4. **SSH 服务状态**: 确保 SSH 服务正在运行，并且没有因为某种原因被禁用或崩溃。重启 SSH 服务可能会解决此问题。

你可以尝试以下步骤来解决这些问题：

- 检查并修改服务器的 SSH 配置，确保 SFTP 子系统已正确配置。
- 确保防火墙上已打开所需的端口并允许访问。
- 确认密码正确并且用户有相关权限。
- 重启 SSH 服务：在服务器上使用命令 `sudo systemctl restart sshd`。

如果以上步骤无法解决问题，尝试在更高的调试级别运行 `scp` 命令：

```sh
scp -v -P 13221 admin@127.0.0.1:/volueme1/L/win11专业精简版.esd /
```

这样可以获得更多详细信息用于进一步诊断问题。
User: (venv) root@PHK110:~# scp -P 13221 admin@127.0.0.1:/volueme1/L/win11专业精简版.esd /root
admin@127.0.0.1's password:
subsystem request failed on channel 0
scp: Connection closed
(venv) root@PHK110:~# scp -P 13221 admin@127.0.0.1:/volueme1/L/win11专业精简版.esd /
admin@127.0.0.1's password:
subsystem request failed on channel 0
scp: Connection closed
(venv) root@PHK110:~# scp -v -P 13221 admin@127.0.0.1:/volueme1/L/win11专业精简版.esd /
Executing: program /usr/bin/ssh host 127.0.0.1, user admin, command sftp
OpenSSH_9.9p1 Debian-3, OpenSSL 3.3.2 3 Sep 2024
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Reading configuration data /etc/ssh/ssh_config.d/20-systemd-ssh-proxy.conf
debug1: /etc/ssh/ssh_config line 21: Applying options for *
debug1: Connecting to 127.0.0.1 [127.0.0.1] port 13221.
debug1: Connection established.
debug1: identity file /root/.ssh/id_rsa type -1
debug1: identity file /root/.ssh/id_rsa-cert type -1
debug1: identity file /root/.ssh/id_ecdsa type -1
debug1: identity file /root/.ssh/id_ecdsa-cert type -1
debug1: identity file /root/.ssh/id_ecdsa_sk type -1
debug1: identity file /root/.ssh/id_ecdsa_sk-cert type -1
debug1: identity file /root/.ssh/id_ed25519 type -1
debug1: identity file /root/.ssh/id_ed25519-cert type -1
debug1: identity file /root/.ssh/id_ed25519_sk type -1
debug1: identity file /root/.ssh/id_ed25519_sk-cert type -1
debug1: identity file /root/.ssh/id_xmss type -1
debug1: identity file /root/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_9.9p1 Debian-3
debug1: Remote protocol version 2.0, remote software version OpenSSH_8.2
debug1: compat_banner: match: OpenSSH_8.2 pat OpenSSH* compat 0x04000000
debug1: Authenticating to 127.0.0.1:13221 as 'admin'
debug1: load_hostkeys: fopen /root/.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: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ssh-ed25519
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: SSH2_MSG_KEX_ECDH_REPLY received
debug1: Server host key: ssh-ed25519 SHA256:j+7hgXP21pnpaBTK2b4mXAu+S4WtPkMIeaOIdzCfSuw
debug1: load_hostkeys: fopen /root/.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 '[127.0.0.1]:13221' is known and matches the ED25519 host key.
debug1: Found key in /root/.ssh/known_hosts:1
debug1: ssh_packet_send2_wrapped: resetting send seqnr 3
debug1: rekey out after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: ssh_packet_read_poll2: resetting read seqnr 3
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey in after 134217728 blocks
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_ext_info_client_parse: server-sig-algs=<ssh-ed25519,<PRESIDIO_ANONYMIZED_EMAIL_ADDRESS>,ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,<PRESIDIO_ANONYMIZED_EMAIL_ADDRESS>>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Will attempt key: /root/.ssh/id_rsa
debug1: Will attempt key: /root/.ssh/id_ecdsa
debug1: Will attempt key: /root/.ssh/id_ecdsa_sk
debug1: Will attempt key: /root/.ssh/id_ed25519
debug1: Will attempt key: /root/.ssh/id_ed25519_sk
debug1: Will attempt key: /root/.ssh/id_xmss
debug1: Trying private key: /root/.ssh/id_rsa
debug1: Trying private key: /root/.ssh/id_ecdsa
debug1: Trying private key: /root/.ssh/id_ecdsa_sk
debug1: Trying private key: /root/.ssh/id_ed25519
debug1: Trying private key: /root/.ssh/id_ed25519_sk
debug1: Trying private key: /root/.ssh/id_xmss
debug1: Next authentication method: password
admin@127.0.0.1's password:
Authenticated to 127.0.0.1 ([127.0.0.1]:13221) using "password".
debug1: channel 0: new session [client-session] (inactive timeout: 0)
debug1: Requesting <PRESIDIO_ANONYMIZED_EMAIL_ADDRESS>
debug1: Entering interactive session.
debug1: pledge: filesystem
debug1: client_input_global_request: rtype <PRESIDIO_ANONYMIZED_EMAIL_ADDRESS> want_reply 0
debug1: client_input_hostkeys: searching /root/.ssh/known_hosts for [127.0.0.1]:13221 / (none)
debug1: client_input_hostkeys: searching /root/.ssh/known_hosts2 for [127.0.0.1]:13221 / (none)
debug1: client_input_hostkeys: hostkeys file /root/.ssh/known_hosts2 does not exist
debug1: Sending environment.
debug1: channel 0: setting env LANG = "zh_CN.UTF-8"
debug1: Sending subsystem: sftp
debug1: client_global_hostkeys_prove_confirm: server used untru
Assistant: 从你的调试输出中可以看出，问题出在 SCP 命令试图使用不正确的子系统。在这种情况下，它试图使用 SFTP 子系统传输文件，而服务器的配置可能没有正确实现支持，导致 "subsystem request failed on channel 0" 错误。这通常意味着服务器在其 SSH 配置中没有正确设置 SFTP 子系统，或者根本没有启用 SFTP。

以下是一些可能的解决方案：

1. **检查 SSH 配置**:
   - 在远程主机上检查 `/etc/ssh/sshd_config` 文件，以确保 SFTP 子系统已正确配置。
   - 确保存在类似以下内容的行：
     ```
     Subsystem sftp /usr/lib/openssh/sftp-server
     ```
   - 如果不存在，添加它，并重新启动 SSH 服务：
     ```bash
     sudo systemctl restart sshd
     ```

2. **权限和路径问题**:
   - 确保 `/usr/lib/openssh/sftp-server`（或上述配置中指定的路径）确实存在且可执行。
   - 确保 SSH 服务拥有正确的权限来访问该路径。

3. **更改传输方式**:
   - SCP 和 SFTP 都基于 SSH，但可能使用不同的方法来传输文件。如果不能解决问题，可以尝试手动使用 SSH 连接并执行其他操作来传输文件或者使用 `rsync` 作为替代方案。

4. **防火墙和端口设置**:
   - 确保用于连接的端口 13221 没有被防火墙阻挡。
   - 使用 `telnet 127.0.0.1 13221` 来测试端口。

如果在完成这些步骤后问题仍然存在，请检查服务器上的 SSH 日志文件（如 `/var/log/auth.log` 或 `/var/log/secure`）以获取更多诊断信息。
User: (venv) root@PHK110:~# ssh admin@127.0.0.1 -p 13221
admin@127.0.0.1's password:

Using terminal commands to modify system configs, execute external binary
files, add files, or install unauthorized third-party apps may lead to system
damages or unexpected behavior, or cause data loss. Make sure you are aware of
the consequences of each command and proceed at your own risk.

Warning: Data should only be stored in shared folders. Data stored elsewhere
may be deleted when the system is updated/restarted.

Could not chdir to home directory /var/services/homes/admin: No such file or directory
admin@qunhui:/$


可是ssh却可以连接啊
Assistant: