Я настраиваю доступ по SFTP с Linux-машины (клиента) на машину с Windows 2012 (сервер).
На стороне сервера я использую coreFTPServer, настроенный только для FTP через SSH и только с ключом аутентификации. Используя клиент coreFPT на моем ноутбуке с Windows, я могу успешно установить соединение. Вместо этого, используя ту же сеть и учетные данные, я не могу подключиться через клиент 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: ssh-rsa-cert-v01@openssh.com,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,curve25519-sha256@libssh.org,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: ssh-rsa-cert-v01@openssh.com,rsa-sha2-512,rsa-sha2-256,ssh-rsa,ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ssh-ed25519-cert-v01@openssh.com,ssh-dss-cert-v01@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-ed25519,ssh-dss
debug2: ciphers ctos: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com,aes128-cbc,aes192-cbc,aes256-cbc
debug2: ciphers stoc: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com,aes128-cbc,aes192-cbc,aes256-cbc
debug2: MACs ctos: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: MACs stoc: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: compression ctos: none,zlib@openssh.com,zlib
debug2: compression stoc: none,zlib@openssh.com,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,rijndael-cbc@lysator.liu.se
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,rijndael-cbc@lysator.liu.se
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 (я предпочитаю генерировать их на стороне клиента, а затем торговать только ключ от паба).
Что мне не хватает?
Спасибо
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