Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

martin

Re: Conn unexpectedly closed. Server sent cmd exit status 1

Please read documentation for common causes of the error.
Serge

I've got the same: "Connection has been unexpectedly closed. Server sent command exit status 1. Error detecting variable containing return code of last command." when tried to execute following command-line:
winscp.com password:username @unix_server.com /command "ls L*" "cd Load" "ls p*" "call sh probe.ksh"
Exit happened when I tried to invoke script probe.ksh on Unix side, where we have /usr/lbin/sftp-server
JP!

I had the same problem and i was able to resolve it.

The passwd file points to the default location of where the user will first see. By default, it is /home/<USERNAME>. The problem came when I wanted to point it to another hard drive and following the instructions in the readme i updated some registry keys.

IT IS CASE SENSITIVE. make sure if you want to point to, lets say the e:\ .. it is E:\ .

Thats the problem i had, and i was able to resolve the issue without resorting to using another program
mc_seem

Re: Conn unexpectedly closed. Server sent cmd exit status 1

Charlie wrote:

If possible can someone please help me with openSSH/WinSCP? (I'm new to the OpenSSH env)


OpenSSH published at sshwindows.sourceforge.net has a glitch on a windows 2003 server.
I had exactly the same problem as you're describing, and eventually found copSSH (https://www.itefix.net/copssh) . This openssh distribution works fine with Windows 2003 Server.

It's not a WinSCP problem, but sshwindows problem. Anyway sshwindows is no longer maintained.

Good luck.
martin

Re: Conn unexpectedly closed. Server sent cmd exit status 1

It seems that the SSH server is not able to launch the SFTP server. Check it the binary /usr/sbin/sftp-server exists and if the user being logged in has sufficient permissions to execute it.
Charlie

Conn unexpectedly closed. Server sent cmd exit status 1

If possible can someone please help me with openSSH/WinSCP? (I'm new to the OpenSSH env)

I have installed OpenSSH on a windows 2003 server and are trying to connect from WinSCP to the Windows server 2003.

I get the following error from WinSCP: Connection has been unexpectedly closed. Server sent command exit status 1. What does this mean? Please help Urgent project to complete.

The OpenSSH Debug file relates to the following:


C:\Program Files\OpenSSH\usr\sbin>sshd -d -d -d
debug2: read_server_config: filename /etc/sshd_config
debug1: sshd version OpenSSH_3.8.1p1
debug3: Not a RSA1 key file /etc/ssh_host_rsa_key.
debug1: read PEM private key done: type RSA
debug1: private host key: #0 type 1 RSA
debug3: Not a RSA1 key file /etc/ssh_host_dsa_key.
debug1: read PEM private key done: type DSA
debug1: private host key: #1 type 2 DSA
debug1: Bind to port 22 on 0.0.0.0.
Server listening on 0.0.0.0 port 22.
debug1: Server will not fork when running in debugging mode.
Connection from 10.231.244.37 port 2305
debug1: Client protocol version 2.0; client software version WinSCP_releas
6
debug1: no match: WinSCP_release_3.7.6
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_3.8.1p1
debug1: list_hostkey_types: ssh-rsa,ssh-dss
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug2: kex_parse_kexinit: diffie-hellman-group-exchange-sha1,diffie-hellm
up1-sha1
debug2: kex_parse_kexinit: ssh-rsa,ssh-dss
debug2: kex_parse_kexinit: aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,ar
aes192-cbc,aes256-cbc,rijndael-cbc@lysator.liu.se,aes128-ctr,aes192-ctr,ae
tr
debug2: kex_parse_kexinit: aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,ar
aes192-cbc,aes256-cbc,rijndael-cbc@lysator.liu.se,aes128-ctr,aes192-ctr,ae
tr
debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,hmac-ripemd160,hmac-ripemd16
ssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,hmac-ripemd160,hmac-ripemd16
ssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: none,zlib
debug2: kex_parse_kexinit: none,zlib
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit: first_kex_follows 0
debug2: kex_parse_kexinit: reserved 0
debug2: kex_parse_kexinit: diffie-hellman-group-exchange-sha1,diffie-hellm
up14-sha1,diffie-hellman-group1-sha1
debug2: kex_parse_kexinit: ssh-rsa,ssh-dss
debug2: kex_parse_kexinit: aes256-cbc,rijndael256-cbc,rijndael-cbc@lysator
e,aes192-cbc,rijndael192-cbc,aes128-cbc,rijndael128-cbc,blowfish-cbc,3des-
debug2: kex_parse_kexinit: aes256-cbc,rijndael256-cbc,rijndael-cbc@lysator
e,aes192-cbc,rijndael192-cbc,aes128-cbc,rijndael128-cbc,blowfish-cbc,3des-
debug2: kex_parse_kexinit: hmac-sha1,hmac-md5,none
debug2: kex_parse_kexinit: hmac-sha1,hmac-md5,none
debug2: kex_parse_kexinit: none,zlib
debug2: kex_parse_kexinit: none,zlib
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit: first_kex_follows 0
debug2: kex_parse_kexinit: reserved 0
debug2: mac_init: found hmac-sha1
debug1: kex: client->server aes256-cbc hmac-sha1 none
debug2: mac_init: found hmac-sha1
debug1: kex: server->client aes256-cbc hmac-sha1 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST_OLD received
debug1: SSH2_MSG_KEX_DH_GEX_GROUP sent
debug2: dh_gen_key: priv key bits set: 261/512
debug2: bits set: 1012/2048
debug1: expecting SSH2_MSG_KEX_DH_GEX_INIT
debug2: bits set: 1037/2048
debug1: SSH2_MSG_KEX_DH_GEX_REPLY sent
debug2: kex_derive_keys
debug2: set_newkeys: mode 1
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug2: set_newkeys: mode 0
debug1: SSH2_MSG_NEWKEYS received
debug1: KEX done
debug1: userauth-request for user la-sftpuser service ssh-connection metho

debug1: attempt 0 failures 0
debug2: input_userauth_request: setting up authctxt for la-sftpuser
debug2: input_userauth_request: try method none
debug1: userauth_banner: sent
Failed none for la-sftpuser from 10.231.244.37 port 2305 ssh2
debug1: userauth-request for user la-sftpuser service ssh-connection metho
oard-interactive
debug1: attempt 1 failures 1
debug2: input_userauth_request: try method keyboard-interactive
debug1: keyboard-interactive devs
debug1: auth2_challenge: user=la-sftpuser devs=
debug1: kbdint_alloc: devices ''
debug2: auth2_challenge_start: devices
Failed keyboard-interactive for la-sftpuser from 10.231.244.37 port 2305 s
debug1: userauth-request for user la-sftpuser service ssh-connection metho
word
debug1: attempt 2 failures 2
debug2: input_userauth_request: try method password
Accepted password for la-sftpuser from 10.231.244.37 port 2305 ssh2
debug1: Entering interactive session for SSH2.
debug2: fd 3 setting O_NONBLOCK
debug2: fd 7 setting O_NONBLOCK
debug1: server_init_dispatch_20
debug1: server_input_channel_open: ctype session rchan 256 win 65536 max 1
debug1: input_session_request
debug1: channel 0: new [server-session]
debug1: session_new: init
debug1: session_new: session 0
debug1: session_open: channel 0
debug1: session_open: session 0: link with channel 0
debug1: server_input_channel_open: confirm session
debug1: server_input_channel_req: channel 0 request subsystem reply 1
debug1: session_by_channel: session 0 channel 0
debug1: session_input_channel_req: session 0 req subsystem
subsystem request for sftp
debug1: subsystem: exec() /usr/sbin/sftp-server
debug2: fd 10 setting O_NONBLOCK
debug2: fd 9 setting O_NONBLOCK
debug1: Received SIGCHLD.
debug1: session_by_pid: pid 5576
debug1: session_exit_message: session 0 channel 0 pid 5576
debug2: channel 0: request exit-status
debug1: session_exit_message: release channel 0
debug2: channel 0: write failed
debug2: channel 0: close_write
debug2: channel 0: output open -> closed
debug1: session_close: session 0 pid 5576
debug2: notify_done: reading
debug2: channel 0: read<=0 rfd 10 len 0
debug2: channel 0: read failed
debug2: channel 0: close_read
debug2: channel 0: input open -> drain
debug2: channel 0: ibuf empty
debug2: channel 0: send eof
debug2: channel 0: input drain -> closed
debug2: channel 0: send close
debug3: channel 0: will not send data after close
debug2: channel 0: rcvd close
debug3: channel 0: will not send data after close
debug2: channel 0: is dead
debug2: channel 0: garbage collecting
debug1: channel 0: free: server-session, nchannels 1
debug3: channel 0: status: The following connections are open:
#0 server-session (t4 r256 i3/0 o3/0 fd -1/-1)

debug3: channel 0: close_fds r -1 w -1 e -1
Connection closed by 10.231.244.37
debug1: do_cleanup
Closing connection to 10.231.244.37