从 CentOS 到 Windows 的 SFTP 无法连接

从 CentOS 到 Windows 的 SFTP 无法连接

我正在配置从 Linux 机器(客户端)到 Windows 2012 机器(服务器)的 SFTP 访问。

在服务器端,我运行 coreFTPServer,配置为仅通过 SSH 进行 FTP 并且仅使用密钥身份验证。使用我的 Windows 笔记本电脑上的 coreFPT 客户端,我可以成功建立连接。相反,在使用相同的网络和凭据时,我无法通过 Linux 客户端进行连接。

我使用以下内容,密钥未使用密码加密:

sftp -i .ssh/priv -P 22 -vvv configured_user@server_ip

我得到了以下输出,调试级别为 3(我隐藏了 IP 和用户名):

OpenSSH_7.4p1, OpenSSL 1.0.2k-fips  26 Jan 2017
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 58: Applying options for *
debug2: resolving "10.135.150.2" port 22
debug2: ssh_connect_direct: needpriv 0
debug1: Connecting to <server_ip> [<server_ip>] port 22.
debug1: Connection established.
debug1: key_load_public: No such file or directory
debug1: identity file .ssh/priv type -1
debug1: key_load_public: No such file or directory
debug1: identity file .ssh/priv-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.4
debug1: Remote protocol version 2.0, remote software version CoreFTP-0.3.3
debug1: no match: CoreFTP-0.3.3
debug2: fd 3 setting O_NONBLOCK
debug1: Authenticating to <server_ip>:22 as '<configured_user>'
debug3: hostkeys_foreach: reading file ".ssh/known_hosts"
debug3: record_hostkey: found key type RSA in file .ssh/known_hosts:1
debug3: load_hostkeys: loaded 1 keys from <server_ip>
debug3: order_hostkeyalgs: prefer hostkeyalgs: [email protected],rsa-sha2-512,rsa-sha2-256,ssh-rsa
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: 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-group-exchange-sha1,diffie-hellman-group14-sha256,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1,ext-info-c
debug2: host key algorithms: [email protected],rsa-sha2-512,rsa-sha2-256,ssh-rsa,[email protected],[email protected],[email protected],[email protected],[email protected],ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-ed25519,ssh-dss
debug2: ciphers ctos: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected],aes128-cbc,aes192-cbc,aes256-cbc
debug2: ciphers stoc: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected],aes128-cbc,aes192-cbc,aes256-cbc
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: diffie-hellman-group1-sha1,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha1,diffie-hellman-group-exchange-sha256
debug2: host key algorithms: ssh-rsa
debug2: ciphers ctos: aes128-cbc,aes128-ctr,3des-cbc,blowfish-cbc,aes192-cbc,aes192-ctr,aes256-cbc,aes256-ctr,rijndael128-cbc,rijndael192-cbc,rijndael256-cbc,[email protected]
debug2: ciphers stoc: aes128-cbc,aes128-ctr,3des-cbc,blowfish-cbc,aes192-cbc,aes192-ctr,aes256-cbc,aes256-ctr,rijndael128-cbc,rijndael192-cbc,rijndael256-cbc,[email protected]
debug2: MACs ctos: hmac-sha2-256,hmac-sha1,hmac-md5,none
debug2: MACs stoc: hmac-sha2-256,hmac-sha1,hmac-md5,none
debug2: compression ctos: none,none
debug2: compression stoc: none,none
debug2: languages ctos:
debug2: languages stoc:
debug2: first_kex_follows 0
debug2: reserved 0
debug1: kex: algorithm: diffie-hellman-group-exchange-sha256
debug1: kex: host key algorithm: ssh-rsa
debug1: kex: server->client cipher: aes128-ctr MAC: hmac-sha2-256 compression: none
debug1: kex: client->server cipher: aes128-ctr MAC: hmac-sha2-256 compression: none
debug1: kex: diffie-hellman-group-exchange-sha256 need=32 dh_need=32
debug1: kex: diffie-hellman-group-exchange-sha256 need=32 dh_need=32
debug3: send packet: type 34
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<8192<8192) sent
debug3: receive packet: type 31
debug1: got SSH2_MSG_KEX_DH_GEX_GROUP
debug2: bits set: 4082/8192
debug3: send packet: type 32
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug3: receive packet: type 33
debug1: got SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Server host key: ssh-rsa SHA256:g1vBYrOo0avwG21dmFm6I6XDA+B4eepZC6+h80TH+XY
debug3: hostkeys_foreach: reading file ".ssh/known_hosts"
debug3: record_hostkey: found key type RSA in file .ssh/known_hosts:1
debug3: load_hostkeys: loaded 1 keys from <server_ip>
debug1: Host '<server_ip>' is known and matches the RSA host key.
debug1: Found key in .ssh/known_hosts:1
debug2: bits set: 4070/8192
ssh_dispatch_run_fatal: Connection to <server_ip> port 22: invalid argument
Couldn't read packet: Connection reset by peer

该问题似乎来自 ssh:

ssh_dispatch_run_fatal: Connection to <server_ip> port 22: invalid argument
Couldn't read packet: Connection reset by peer

但我无法找出原因,我尝试了几个密钥对,既从客户端用 ssh-keygen(RSA 和 DSA)生成,又从服务器端用 CoreFTPServer 生成(我更喜欢在客户端生成它们,然后只交易公钥)。

我错过了什么?

谢谢

答案1

sftp -i .ssh/priv -P 22 -vvv configured_user@server_ip https://linux.die.net/man/1/sftp

您传递给 sftp 的选项均无效,您传递的选项有效,scp或者可能ssh

尝试使用scp https://linux.die.net/man/1/scp

相关内容