1

My Server is Ubuntu 14.04.5 LTS and I am able to connect via SSH with PuTTY, but I'm not able to connect via WinSCP.

When I try to connect via WinSCP, it gives the error:

Connection has been unexpectedly closed. server sent command exit status 127

Connection has been unexpectedly closed

Below is a log file

. 2019-01-23 15:40:22.694 --------------------------------------------------------------------------
. 2019-01-23 15:40:22.694 WinSCP Version 5.13.7 (Build 9125) (OS 6.1.7601 Service Pack 1 - Windows 7 Professional)
. 2019-01-23 15:40:22.694 Configuration: HKCU\Software\Martin Prikryl\WinSCP 2\
. 2019-01-23 15:40:22.695 Log level: Normal
. 2019-01-23 15:40:22.695 Local account: D146\Subhash
. 2019-01-23 15:40:22.695 Working directory: C:\Program Files (x86)\WinSCP
. 2019-01-23 15:40:22.695 Process ID: 6672
. 2019-01-23 15:40:22.696 Command-line: "C:\Program Files (x86)\WinSCP\WinSCP.exe" 
. 2019-01-23 15:40:22.696 Time zone: Current: GMT+5:30 (India Standard Time), No DST
. 2019-01-23 15:40:22.696 Login time: 23 January 2019 PM 3:40:22
. 2019-01-23 15:40:22.696 --------------------------------------------------------------------------
. 2019-01-23 15:40:22.696 Session name: winscp testing (Site)
. 2019-01-23 15:40:22.696 Host name: 71.6.186.24 (Port: 22)
. 2019-01-23 15:40:22.697 User name: root (Password: Yes, Key file: No, Passphrase: No)
. 2019-01-23 15:40:22.697 Tunnel: No
. 2019-01-23 15:40:22.697 Transfer Protocol: SFTP
. 2019-01-23 15:40:22.697 Ping type: Off, Ping interval: 30 sec; Timeout: 15 sec
. 2019-01-23 15:40:22.697 Disable Nagle: No
. 2019-01-23 15:40:22.697 Proxy: None
. 2019-01-23 15:40:22.697 Send buffer: 262144
. 2019-01-23 15:40:22.697 SSH protocol version: 2; Compression: No
. 2019-01-23 15:40:22.697 Bypass authentication: No
. 2019-01-23 15:40:22.697 Try agent: Yes; Agent forwarding: No; TIS/CryptoCard: No; KI: Yes; GSSAPI: Yes
. 2019-01-23 15:40:22.697 GSSAPI: Forwarding: No; Libs: gssapi32,sspi,custom; Custom: 
. 2019-01-23 15:40:22.697 Ciphers: aes,chacha20,blowfish,3des,WARN,arcfour,des; Ssh2DES: No
. 2019-01-23 15:40:22.697 KEX: ecdh,dh-gex-sha1,dh-group14-sha1,rsa,WARN,dh-group1-sha1
. 2019-01-23 15:40:22.697 SSH Bugs: Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto
. 2019-01-23 15:40:22.697 Simple channel: Yes
. 2019-01-23 15:40:22.697 Return code variable: Autodetect; Lookup user groups: Auto
. 2019-01-23 15:40:22.697 Shell: default
. 2019-01-23 15:40:22.697 EOL: LF, UTF: Auto
. 2019-01-23 15:40:22.697 Clear aliases: Yes, Unset nat.vars: Yes, Resolve symlinks: Yes; Follow directory symlinks: No
. 2019-01-23 15:40:22.697 LS: ls -la, Ign LS warn: Yes, Scp1 Comp: No
. 2019-01-23 15:40:22.697 SFTP Bugs: Auto,Auto
. 2019-01-23 15:40:22.697 SFTP Server: default
. 2019-01-23 15:40:22.698 Local directory: C:\Users\Subhash\Documents, Remote directory: /, Update: Yes, Cache: Yes
. 2019-01-23 15:40:22.698 Cache directory changes: Yes, Permanent: Yes
. 2019-01-23 15:40:22.698 Recycle bin: Delete to: No, Overwritten to: No, Bin path: 
. 2019-01-23 15:40:22.698 DST mode: Unix
. 2019-01-23 15:40:22.698 --------------------------------------------------------------------------
. 2019-01-23 15:40:22.722 Looking up host "71.6.186.24" for SSH connection
. 2019-01-23 15:40:22.722 Connecting to 71.6.186.24 port 22
. 2019-01-23 15:40:22.977 We claim version: SSH-2.0-WinSCP_release_5.13.7
. 2019-01-23 15:40:23.234 Server version: SSH-2.0-OpenSSH_6.0p1 Debian-4+deb7u2
. 2019-01-23 15:40:23.235 We believe remote version has SSH-2 channel request bug
. 2019-01-23 15:40:23.235 Using SSH protocol version 2
. 2019-01-23 15:40:23.235 Have a known host key of type ecdsa-sha2-nistp256
. 2019-01-23 15:40:23.491 Doing ECDH key exchange with curve nistp256 and hash SHA-256
. 2019-01-23 15:40:23.822 Server also has ssh-dss/ssh-rsa host keys, but we don't know any of them
. 2019-01-23 15:40:23.822 Host key fingerprint is:
. 2019-01-23 15:40:23.822 ecdsa-sha2-nistp256 256 f0:39:24:5c:63:12:5a:0d:e3:35:08:3d:91:d2:9f:53 7HbkGPzNm6tuAiqUoEpiHX4jxoNzxJgXQjWOgjuKGM8=
. 2019-01-23 15:40:23.871 Host key matches cached key
. 2019-01-23 15:40:23.871 Initialised AES-256 SDCTR client->server encryption
. 2019-01-23 15:40:23.871 Initialised HMAC-SHA-256 client->server MAC algorithm
. 2019-01-23 15:40:23.871 Initialised AES-256 SDCTR server->client encryption
. 2019-01-23 15:40:23.871 Initialised HMAC-SHA-256 server->client MAC algorithm
! 2019-01-23 15:40:24.426 Using username "root".
. 2019-01-23 15:40:24.744 Server offered these authentication methods: publickey,password,keyboard-interactive
. 2019-01-23 15:40:24.745 Attempting keyboard-interactive authentication
. 2019-01-23 15:40:25.002 Server refused keyboard-interactive authentication
. 2019-01-23 15:40:25.002 Server offered these authentication methods: publickey,password,keyboard-interactive
. 2019-01-23 15:40:25.002 Prompt (password, "SSH password", <no instructions>, "&Password: ")
. 2019-01-23 15:40:25.002 Using stored password.
. 2019-01-23 15:40:25.059 Sent password
. 2019-01-23 15:40:25.331 Access granted
. 2019-01-23 15:40:25.331 Opening session as main channel
. 2019-01-23 15:40:25.585 Opened main channel
. 2019-01-23 15:40:26.134 Started a shell/command
. 2019-01-23 15:40:26.148 --------------------------------------------------------------------------
. 2019-01-23 15:40:26.148 Using SFTP protocol.
. 2019-01-23 15:40:26.149 Doing startup conversation with host.
. 2019-01-23 15:40:26.149 Server sent command exit status 127
. 2019-01-23 15:40:26.150 Disconnected: All channels closed
* 2019-01-23 15:40:26.187 (EFatal) **Connection has been unexpectedly closed.** Server sent command exit status 127.
5
  • Show us WinSCP session log file. Jan 22, 2019 at 8:32
  • @MartinPrikrylThanks for an answer, please check log in questions.
    – Subhash
    Jan 23, 2019 at 10:12
  • OK, so can you connect using any other SFTP client? Jan 23, 2019 at 13:45
  • @MartinPrikryl Yes, also not able to connect with FileZilla. Error: Received unexpected end-of-file from SFTP server Error: Could not connect to server I don't know why not able to connect with SFTP but able to connect with Putty.
    – Subhash
    Jan 23, 2019 at 13:57
  • OK, so then you should rephrase your question. It's not about WinSCP, but about SFTP. Jan 23, 2019 at 14:00

1 Answer 1

2

To access your sftp from other hosts, please make sure following is installed and configured properly.

  • Installed OpenSSH servers
  • Configured sshd_config
    • PubkeyAuthentication yes
    • Subsystem sftp internal-sftp
  • Added your public key to ~/.ssh/authorized_keys

  • Start the ssh server with port 22/TCP open # /etc/init.d/sshd start

  • # iptables -I INPUT -j ACCEPT -p tcp --dport 22

Finally, test $ sftp <login>@<hostname>

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .