Topic "Error:Server unexpectedly closed network connection."

Author Message
judes143

Guest


Alright, I couldn't find anything to help me with this problem my friend has been having.

when she tries to log on
this shows up "Server unexpectedly closed network connection." like a kind of alert.

I host the site and no one else is having trouble but here and were about 10 that log on with the same port username and password.


The port and host name and everything is all correct.
So I don't see why this continues to happen even after she's restarted her computer and has never had this problem before.

If you could possibly redirect me to where I can find Help or even answer my question here It would be greatly appreciated.

Thank you.
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
Please read documentation. If that does not help, come back.
_________________
Martin Prikryl
Judes143

Guest


I read that, and it just tells me why it doesn't work.
but, it used to work she was able to log on for a few months now and then one day randomly it stopped working
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
Judes143 wrote:
I read that, and it just tells me why it doesn't work.
but, it used to work she was able to log on for a few months now and then one day randomly it stopped working

And did you check the server's log, as suggested in the doc?
_________________
Martin Prikryl
Judes143

Guest


No I haven't actually only because i've been trying to find where to look, or would it possibly be her who has to look.
I'm sorry i'm very confused when it comes down to winscp not working correctly.
Judes143

Guest


I'm still completely lost, and don't understand where to look for anything.

I've googled the problem but i don't know how to check my log.

is it possible for anyone to help?
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
Doy ou know what the server software is?
_________________
Martin Prikryl
Judes143

Guest


my friend who can't log in as a dell lab top, and she uses windows vista, since that's prolly not the info you needed,

I have a domain at dreamhost.com
and the server i use there.
is
judes.forevershunned.com

and duffman.

Im sorry, im really bad with finding what server it is and what host and this and that.

if you have a guide i missed somewhere telling me how to find everything i could explain it to you better.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
Judes143 wrote:
if you have a guide i missed somewhere telling me how to find everything i could explain it to you better.

Sorry, but I cannot tell you how to find it. Try to contact your server administrator.
_________________
Martin Prikryl
Dmitry Bolkhovityanov

Guest


Martin, isn't it that "KeepAlive mesages ignored by default by WinSCP" problem?

I have exactly the same situation -- previously using WinSCP to connect to CentOS-4 machine everything was okay, but since upgrade to CentOS-5 I often (about server's ClientAliveInterval*Count seconds) encounter the same unexpected connection close.

The trick in my situation is probably that in CentOS-4 SSH1 protocol was allowed, which didn't include "application pings", while currently it is only SSH2 allowed, which DOES support that feature.

And, probably, judes143 also has remote server just-upgraded.

Wouldn't it be wise to just turn "full SSH2 support" on by default?
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
Dmitry Bolkhovityanov wrote:
Wouldn't it be wise to just turn "full SSH2 support" on by default?

I do not understand you suggestion.
Do you mean that WinSCP does not reply to pings from server (what I cannot confirm atm), which are sent only with SSH2?
What do you mean by turning on "full SSH2 support"?
_________________
Martin Prikryl
Austen

Guest


allright, I may be a noob, but i figured it out for you all!

I have an iphone 3g - firmware 2.2.1, jailbreaked with quickpwn 2.2.1

I tried and tried and tried to connect thru winscp but kept getting that message "server unexpectedly closed network connection"

I installed "openSSH" and unix subsystems in installer. But STILL I was getting the same error. I tried adding "vsftpd" (from BigBoss) in Cydia. Still no luck. Then I noticed openSSL in installer. I installed that and VOILA!!

Matter of fact, to my recolection, openSSH and openSSL and unix subsystem were pre-installed when I did the jailbreak. But in my stupidity I unistalled what I thought were uneeded programs. There you have it. When using quickpwn, TRUST them!

I guess my only question is now, how to I get my phone to stay "awake" during file transfer - because letting it sleep cuts out the wifi connection ??
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
Austen wrote:
allright, I may be a noob, but i figured it out for you all!

I have an iphone 3g - firmware 2.2.1, jailbreaked with quickpwn 2.2.1

I tried and tried and tried to connect thru winscp but kept getting that message "server unexpectedly closed network connection"

I installed "openSSH" and unix subsystems in installer. But STILL I was getting the same error. I tried adding "vsftpd" (from BigBoss) in Cydia. Still no luck. Then I noticed openSSL in installer. I installed that and VOILA!!

Matter of fact, to my recolection, openSSH and openSSL and unix subsystem were pre-installed when I did the jailbreak. But in my stupidity I unistalled what I thought were uneeded programs. There you have it. When using quickpwn, TRUST them!

Thanks for sharing your solution. Though, this topic is not iPod/iPhone related at all.

Quote:
I guess my only question is now, how to I get my phone to stay "awake" during file transfer - because letting it sleep cuts out the wifi connection ??

Please read FAQ. If that does not help, come back.
XvXkellettXvX

Guest


i hav a log for my problem which is the same thing:
. 2010-04-23 16:20:50.593 --------------------------------------------------------------------------
. 2010-04-23 16:20:50.593 WinSCP Version 3.8.2 (Build 330) (OS 6.0.6001 Service Pack 1)
. 2010-04-23 16:20:50.593 Login time: Friday, April 23, 2010 4:20:50 PM
. 2010-04-23 16:20:50.593 --------------------------------------------------------------------------
. 2010-04-23 16:20:50.593 Session name: session
. 2010-04-23 16:20:50.593 Host name: 192.168.2.104 (Port: 22)
. 2010-04-23 16:20:50.594 User name: root (Password: Yes, Key file: No)
. 2010-04-23 16:20:50.594 Transfer Protocol: SFTP (SCP)
. 2010-04-23 16:20:50.594 SSH protocol version: 2; Compression: No
. 2010-04-23 16:20:50.594 Agent forwarding: No; TIS/CryptoCard: No; KI: Yes; GSSAPI: No
. 2010-04-23 16:20:50.594 Ciphers: aes,blowfish,3des,WARN,des; Ssh2DES: No
. 2010-04-23 16:20:50.594 Ping type: -, Ping interval: 30 sec; Timeout: 15 sec
. 2010-04-23 16:20:50.594 SSH Bugs: -,-,-,-,-,-,-,-
. 2010-04-23 16:20:50.594 SFTP Bugs: -,-,-
. 2010-04-23 16:20:50.594 Proxy: none
. 2010-04-23 16:20:50.594 Return code variable: Autodetect; Lookup user groups: Yes
. 2010-04-23 16:20:50.594 Shell: default, EOL: 0
. 2010-04-23 16:20:50.594 Local directory: default, Remote directory: home, Update: No, Cache: Yes
. 2010-04-23 16:20:50.594 Cache directory changes: Yes, Permanent: Yes
. 2010-04-23 16:20:50.594 Clear aliases: Yes, Unset nat.vars: Yes, Resolve symlinks: Yes
. 2010-04-23 16:20:50.594 Alias LS: No, Ign LS warn: Yes, Scp1 Comp: No
. 2010-04-23 16:20:50.594 --------------------------------------------------------------------------
. 2010-04-23 16:20:50.644 Looking up host "192.168.2.104"
. 2010-04-23 16:20:50.649 Connecting to 192.168.2.104 port 22
. 2010-04-23 16:20:50.796 Server unexpectedly closed network connection
* 2010-04-23 16:20:50.810 (ESshFatal) Server unexpectedly closed network connection
. 2010-04-23 16:20:55.694 --------------------------------------------------------------------------
. 2010-04-23 16:20:55.694 WinSCP Version 3.8.2 (Build 330) (OS 6.0.6001 Service Pack 1)
. 2010-04-23 16:20:55.694 Login time: Friday, April 23, 2010 4:20:55 PM
. 2010-04-23 16:20:55.694 --------------------------------------------------------------------------
. 2010-04-23 16:20:55.694 Session name: session
. 2010-04-23 16:20:55.694 Host name: 192.168.2.104 (Port: 22)
. 2010-04-23 16:20:55.694 User name: root (Password: Yes, Key file: No)
. 2010-04-23 16:20:55.694 Transfer Protocol: SFTP (SCP)
. 2010-04-23 16:20:55.694 SSH protocol version: 2; Compression: No
. 2010-04-23 16:20:55.694 Agent forwarding: No; TIS/CryptoCard: No; KI: Yes; GSSAPI: No
. 2010-04-23 16:20:55.694 Ciphers: aes,blowfish,3des,WARN,des; Ssh2DES: No
. 2010-04-23 16:20:55.694 Ping type: -, Ping interval: 30 sec; Timeout: 15 sec
. 2010-04-23 16:20:55.694 SSH Bugs: -,-,-,-,-,-,-,-
. 2010-04-23 16:20:55.695 SFTP Bugs: -,-,-
. 2010-04-23 16:20:55.695 Proxy: none
. 2010-04-23 16:20:55.695 Return code variable: Autodetect; Lookup user groups: Yes
. 2010-04-23 16:20:55.695 Shell: default, EOL: 0
. 2010-04-23 16:20:55.695 Local directory: default, Remote directory: home, Update: No, Cache: Yes
. 2010-04-23 16:20:55.695 Cache directory changes: Yes, Permanent: Yes
. 2010-04-23 16:20:55.695 Clear aliases: Yes, Unset nat.vars: Yes, Resolve symlinks: Yes
. 2010-04-23 16:20:55.695 Alias LS: No, Ign LS warn: Yes, Scp1 Comp: No
. 2010-04-23 16:20:55.695 --------------------------------------------------------------------------
. 2010-04-23 16:20:55.699 Looking up host "192.168.2.104"
. 2010-04-23 16:20:55.699 Connecting to 192.168.2.104 port 22
. 2010-04-23 16:20:55.758 Server unexpectedly closed network connection
* 2010-04-23 16:20:55.763 (ESshFatal) Server unexpectedly closed network connection
Guest




I'm not sure if this is of any help but I get the same problem caused by Norton Internet Security.

Problem is it's not simple to pin down as it only seems to effect certain servers and on certain ports.
(Port 81 is currently causing me headaches, while port 22 allows me connect no problem. I know these are meant for different things but the server is set up to listen on port 81 which I can't change, ugh.)

Anyway, disabling Norton allows me to connect no problem, which isn't a fix but at least lets me get the job done temporarily.
Something in Norton somewhere is blocking the connection. I'm on a mission to find out what.

If your friend is running Norton, try disabling it and connecting.

* To note my problem isn't a WInSCP one, its a Norton one, but you mentioned your friend had a dell laptop and they often come with all sorts pre-installed. Thought I would mention on the off chance she has Norton also.
Dylan(theawesome)

Guest


i had the same error. make sure if you installed cydia and rock onur ipohne make sure thast ssh is only installed on one. then once that is completed, reinstall openssh. then there you go.
djsmoove

Guest


HI THERE. NOT SUR EIF YOU GOT THIS SOLUTION YET BUT JUST GO TO SETTINGS, GENERAL, AUTO-LOCK, AND CHOOSE NEVER. YOU CAN CHANGE IT BACK AFTER YOURE DONE SSH Very Happy

I guess my only question is now, how to I get my phone to stay "awake" during file transfer - because letting it sleep cuts out the wifi connection ??[/quote]
gtr32

Guest


To fix this. reinstall your ssh program on your iphone in cydia (eg openSSH). Because everyone has a different version ios jailbreak apps work differently some work flawlessly others don't.

Remember to set your "Auto-Lock" to never whille your ssh to iphone and turn it back on when finished.

other wise pick another ssh program that works well for you.
jchemers_at_hinda_dot_com

Guest


Hello, We are trying to transmit a file from us to the bank. Most of the time the transmission works. According to the bank's review of our log, they say we sometimes don't get past the usersname/password. Here are the sections of the log that shows when WinSCP works and when it fails. I also included the WinSCP script. We plan to put WireShark on the server transmitting from us to the bank. Aslo, we see no issues with the firewall. We're using SFTP (FTP over SSH). The bank is using Maverick SSHD.

-----------------------
-- ERROR FROM LAST LINE
-----------------------
server unexpectedly closed network connection winscp


---------------------------
-- LOG FOR FAILUE
---------------------------
. 2010-10-13 02:24:45.250 --------------------------------------------------------------------------
. 2010-10-13 02:24:45.250 WinSCP Version 4.2.8 (Build 818) (OS 5.2.3790 Service Pack 2)
. 2010-10-13 02:24:45.250 Login time: Wednesday, October 13, 2010 2:24:45 AM
. 2010-10-13 02:24:45.250 --------------------------------------------------------------------------
. 2010-10-13 02:24:45.250 Session name: ABC123-SEND@sftp.abc123xyz.pdq.com
. 2010-10-13 02:24:45.250 Host name: sftp.tradinggrid.gxs.com (Port: 22)
. 2010-10-13 02:24:45.250 User name: ABC123-SEND (Password: Yes, Key file: No)
. 2010-10-13 02:24:45.250 Tunnel: No
. 2010-10-13 02:24:45.250 Transfer Protocol: SFTP (SCP)
. 2010-10-13 02:24:45.250 Ping type: -, Ping interval: 30 sec; Timeout: 15 sec
. 2010-10-13 02:24:45.250 Proxy: none
. 2010-10-13 02:24:45.250 SSH protocol version: 2; Compression: No
. 2010-10-13 02:24:45.250 Bypass authentication: No
. 2010-10-13 02:24:45.250 Try agent: Yes; Agent forwarding: No; TIS/CryptoCard: No; KI: Yes; GSSAPI: No
. 2010-10-13 02:24:45.250 Ciphers: aes,blowfish,3des,WARN,arcfour,des; Ssh2DES: No
. 2010-10-13 02:24:45.250 SSH Bugs: -,-,-,-,-,-,-,-,-
. 2010-10-13 02:24:45.250 SFTP Bugs: -,-
. 2010-10-13 02:24:45.250 Return code variable: Autodetect; Lookup user groups: Yes
. 2010-10-13 02:24:45.250 Shell: default
. 2010-10-13 02:24:45.250 EOL: 0, UTF: 2
. 2010-10-13 02:24:45.250 Clear aliases: Yes, Unset nat.vars: Yes, Resolve symlinks: Yes
. 2010-10-13 02:24:45.250 LS: ls -la, Ign LS warn: Yes, Scp1 Comp: No
. 2010-10-13 02:24:45.250 Local directory: default, Remote directory: home, Update: No, Cache: Yes
. 2010-10-13 02:24:45.250 Cache directory changes: Yes, Permanent: Yes
. 2010-10-13 02:24:45.250 DST mode: 1
. 2010-10-13 02:24:45.250 --------------------------------------------------------------------------
. 2010-10-13 02:24:45.250 Looking up host "sftp.abc123xyz.pdq.com"
. 2010-10-13 02:24:45.468 Connecting to 123.456.789.12 port 22
. 2010-10-13 02:24:45.500 Server version: SSH-2.0-GXSSSHD_Comments
. 2010-10-13 02:24:45.500 We believe remote version has SSH-2 ignore bug
. 2010-10-13 02:24:45.500 Using SSH protocol version 2
. 2010-10-13 02:24:45.500 We claim version: SSH-2.0-WinSCP_release_4.2.8
. 2010-10-13 02:24:45.515 Using Diffie-Hellman with standard group "group14"
. 2010-10-13 02:24:45.515 Doing Diffie-Hellman key exchange with hash SHA-1
. 2010-10-13 02:24:45.593 Server unexpectedly closed network connection


------------------------
-- LOG FOR SUCCESS
-------------------------






. 2010-10-13 11:38:33.265 --------------------------------------------------------------------------
. 2010-10-13 11:38:33.265 WinSCP Version 4.2.8 (Build 818) (OS 5.2.3790 Service Pack 2)
. 2010-10-13 11:38:33.265 Login time: Wednesday, October 13, 2010 11:38:33 AM
. 2010-10-13 11:38:33.265 --------------------------------------------------------------------------
. 2010-10-13 11:38:33.265 Session name: ABC123-SEND@sftp.abc123xyz.pdq.com
. 2010-10-13 11:38:33.265 Host name: sftp.abc123xyz.pdq.com (Port: 22)
. 2010-10-13 11:38:33.265 User name: ABC123-SEND (Password: Yes, Key file: No)
. 2010-10-13 11:38:33.265 Tunnel: No
. 2010-10-13 11:38:33.265 Transfer Protocol: SFTP (SCP)
. 2010-10-13 11:38:33.265 Ping type: -, Ping interval: 30 sec; Timeout: 15 sec
. 2010-10-13 11:38:33.265 Proxy: none
. 2010-10-13 11:38:33.265 SSH protocol version: 2; Compression: No
. 2010-10-13 11:38:33.265 Bypass authentication: No
. 2010-10-13 11:38:33.265 Try agent: Yes; Agent forwarding: No; TIS/CryptoCard: No; KI: Yes; GSSAPI: No
. 2010-10-13 11:38:33.265 Ciphers: aes,blowfish,3des,WARN,arcfour,des; Ssh2DES: No
. 2010-10-13 11:38:33.265 SSH Bugs: -,-,-,-,-,-,-,-,-
. 2010-10-13 11:38:33.265 SFTP Bugs: -,-
. 2010-10-13 11:38:33.265 Return code variable: Autodetect; Lookup user groups: Yes
. 2010-10-13 11:38:33.265 Shell: default
. 2010-10-13 11:38:33.265 EOL: 0, UTF: 2
. 2010-10-13 11:38:33.265 Clear aliases: Yes, Unset nat.vars: Yes, Resolve symlinks: Yes
. 2010-10-13 11:38:33.265 LS: ls -la, Ign LS warn: Yes, Scp1 Comp: No
. 2010-10-13 11:38:33.265 Local directory: default, Remote directory: home, Update: No, Cache: Yes
. 2010-10-13 11:38:33.265 Cache directory changes: Yes, Permanent: Yes
. 2010-10-13 11:38:33.265 DST mode: 1
. 2010-10-13 11:38:33.265 --------------------------------------------------------------------------
. 2010-10-13 11:38:33.265 Looking up host "sftp.abc123xyz.pdq.com"
. 2010-10-13 11:38:33.359 Connecting to 123.456.789.12 port 22
. 2010-10-13 11:38:33.390 Server version: SSH-2.0-GXSSSHD_Comments
. 2010-10-13 11:38:33.390 We believe remote version has SSH-2 ignore bug
. 2010-10-13 11:38:33.390 Using SSH protocol version 2
. 2010-10-13 11:38:33.390 We claim version: SSH-2.0-WinSCP_release_4.2.8
. 2010-10-13 11:38:33.406 Using Diffie-Hellman with standard group "group14"
. 2010-10-13 11:38:33.406 Doing Diffie-Hellman key exchange with hash SHA-1
. 2010-10-13 11:38:33.703 Host key fingerprint is:
. 2010-10-13 11:38:33.703 ssh-rsa 1024 3123e:5313213:d1:4234258:1:53453456db:36346346346634f:e63464681:a9
. 2010-10-13 11:38:33.703 Initialised AES-256 CBC client->server encryption
. 2010-10-13 11:38:33.703 Initialised HMAC-SHA1 client->server MAC algorithm
. 2010-10-13 11:38:33.703 Initialised AES-256 CBC server->client encryption
. 2010-10-13 11:38:33.703 Initialised HMAC-SHA1 server->client MAC algorithm
! 2010-10-13 11:38:33.890 Using username "ABC123-SEND".
. 2010-10-13 11:38:33.906 Prompt (6, SSH password, , &Password: )
. 2010-10-13 11:38:33.906 Using stored password.
. 2010-10-13 11:38:33.906 Sent password
. 2010-10-13 11:38:34.234 Access granted
. 2010-10-13 11:38:34.250 Opened channel for session
. 2010-10-13 11:38:34.671 Started a shell/command
. 2010-10-13 11:38:34.671 --------------------------------------------------------------------------
. 2010-10-13 11:38:34.671 Using SFTP protocol.
. 2010-10-13 11:38:34.671 Doing startup conversation with host.
> 2010-10-13 11:38:34.671 Type: SSH_FXP_INIT, Size: 5, Number: -1
< 2010-10-13 11:38:34.687 Type: SSH_FXP_VERSION, Size: 5, Number: -1
. 2010-10-13 11:38:34.687 SFTP version 3 negotiated.
. 2010-10-13 11:38:34.687 We believe the server has signed timestamps bug
. 2010-10-13 11:38:34.687 We will use UTF-8 strings for status messages only
. 2010-10-13 11:38:34.687 Getting current directory name.
. 2010-10-13 11:38:34.687 Getting real path for '.'
> 2010-10-13 11:38:34.687 Type: SSH_FXP_REALPATH, Size: 10, Number: 16
< 2010-10-13 11:38:34.703 Type: SSH_FXP_NAME, Size: 61, Number: 16
. 2010-10-13 11:38:34.703 Real path is '/ABC123-SEND'
. 2010-10-13 11:38:34.703 Startup conversation with host finished.
< 2010-10-13 11:38:34.703 Script: Active session: [1] ABC123-SEND@sftp.abc123xyz.pdq.com
> 2010-10-13 11:38:34.703 Script: CD ACCTRECON-AR3-A:/*BIN
. 2010-10-13 11:38:34.703 Cached directory change via "ACCTRECON-AR3-A:/*BIN" to "/ABC123-SEND/ACCTRECON-AR3-A:/*BIN".
. 2010-10-13 11:38:34.703 Getting current directory name.
< 2010-10-13 11:38:34.703 Script: /ABC123-SEND/ACCTRECON-AR3-A:/*BIN
> 2010-10-13 11:38:34.703 Script: option transfer binary
< 2010-10-13 11:38:34.703 Script: transfer binary
> 2010-10-13 11:38:34.703 Script: put D:\PSOFT\PSPRD\interfac\APPosPay\HOWDY-APPOSPAY-2010-10-13T02-24-43.txt
. 2010-10-13 11:38:34.703 Copying 1 files/directories to remote directory "/ABC123-SEND/ACCTRECON-AR3-A:/*BIN"
. 2010-10-13 11:38:34.703 PrTime: Yes; PrRO: No; Rght: rw-r--r--; PrR: No (No); FnCs: N; RIC: 01; Resume: S (102400); CalcS: No; Mask:
. 2010-10-13 11:38:34.703 TM: B; ClAr: No; CPS: 0; ExclM(No):
. 2010-10-13 11:38:34.703 AscM: *.*html; *.htm; *.txt; *.php; *.php3; *.cgi; *.c; *.cpp; *.h; *.pas; *.bas; *.tex; *.pl; .htaccess; *.xtml; *.css; *.cfg; *.ini; *.sh; *.xml
. 2010-10-13 11:38:34.703 File: "D:\PSOFT\PSPRD\interfac\APPosPay\HOWDY-APPOSPAY-2010-10-13T02-24-43.txt"
. 2010-10-13 11:38:34.718 Copying "D:\PSOFT\PSPRD\interfac\APPosPay\HOWDY-APPOSPAY-2010-10-13T02-24-43.txt" to remote directory started.
. 2010-10-13 11:38:34.718 Binary transfer mode selected.
. 2010-10-13 11:38:34.718 Opening remote file.
> 2010-10-13 11:38:34.718 Type: SSH_FXP_OPEN, Size: 100, Number: 259
< 2010-10-13 11:38:34.843 Type: SSH_FXP_HANDLE, Size: 33, Number: 259
> 2010-10-13 11:38:34.843 Type: SSH_FXP_WRITE, Size: 3705, Number: 774
> 2010-10-13 11:38:34.843 Type: SSH_FXP_CLOSE, Size: 33, Number: 1028
> 2010-10-13 11:38:34.843 Type: SSH_FXP_SETSTAT, Size: 96, Number: 521
< 2010-10-13 11:38:34.859 Type: SSH_FXP_STATUS, Size: 49, Number: 774
< 2010-10-13 11:38:34.859 Type: SSH_FXP_STATUS, Size: 40, Number: 1028
< 2010-10-13 11:38:34.859 Status code: 0
< 2010-10-13 11:38:34.859 Type: SSH_FXP_STATUS, Size: 40, Number: 521
< 2010-10-13 11:38:34.859 Status code: 0
> 2010-10-13 11:38:34.859 Script: close
. 2010-10-13 11:38:34.859 Closing connection.
. 2010-10-13 11:38:34.859 Sending special code: 12
. 2010-10-13 11:38:34.859 Sent EOF message
jch3m3rz

Guest


Hello

This is the sample SFTP script. Username/p&szw*rds changed

# Automatically answer all prompts negatively not to stall
# the script on errors
option batch on
# Disable overwrite confirmations that conflict with the previous
option confirm off
# Connect using a password
#
# Connect
open ABC123-SEND:I213213433HN@sftp.abc123xyz.pdq.com -hostkey="ssh-rsa 1024 321321:b8:154235345f:e4:55:53453481:345349"
# Change remote directory
CD ACCTRECON-AR3-A:/*BIN
# Force binary mode transfer
option transfer binary
# Upload the file to current working directory
put D:\PSOFT\PSPRD\interfac\APPosPay\HOWDY-APPOSPAY-2010-10-28T02-25-02.txt
# Disconnect
close
# Exit WinSCP
exit


jchemers_at_hinda_dot_com wrote:
Hello, We are trying to transmit a file from us to the bank. Most of the time the transmission works. According to the bank's review of our log, they say we sometimes don't get past the usersname/password. Here are the sections of the log that shows when WinSCP works and when it fails. I also included the WinSCP script. We plan to put WireShark on the server transmitting from us to the bank. Aslo, we see no issues with the firewall. We're using SFTP (FTP over SSH). The bank is using Maverick SSHD.

-----------------------
-- ERROR FROM LAST LINE
-----------------------
server unexpectedly closed network connection winscp


---------------------------
-- LOG FOR FAILUE
---------------------------
. 2010-10-13 02:24:45.250 --------------------------------------------------------------------------
. 2010-10-13 02:24:45.250 WinSCP Version 4.2.8 (Build 818) (OS 5.2.3790 Service Pack 2)
. 2010-10-13 02:24:45.250 Login time: Wednesday, October 13, 2010 2:24:45 AM
. 2010-10-13 02:24:45.250 --------------------------------------------------------------------------
. 2010-10-13 02:24:45.250 Session name: ABC123-SEND@sftp.abc123xyz.pdq.com
. 2010-10-13 02:24:45.250 Host name: sftp.tradinggrid.gxs.com (Port: 22)
. 2010-10-13 02:24:45.250 User name: ABC123-SEND (Password: Yes, Key file: No)
. 2010-10-13 02:24:45.250 Tunnel: No
. 2010-10-13 02:24:45.250 Transfer Protocol: SFTP (SCP)
. 2010-10-13 02:24:45.250 Ping type: -, Ping interval: 30 sec; Timeout: 15 sec
. 2010-10-13 02:24:45.250 Proxy: none
. 2010-10-13 02:24:45.250 SSH protocol version: 2; Compression: No
. 2010-10-13 02:24:45.250 Bypass authentication: No
. 2010-10-13 02:24:45.250 Try agent: Yes; Agent forwarding: No; TIS/CryptoCard: No; KI: Yes; GSSAPI: No
. 2010-10-13 02:24:45.250 Ciphers: aes,blowfish,3des,WARN,arcfour,des; Ssh2DES: No
. 2010-10-13 02:24:45.250 SSH Bugs: -,-,-,-,-,-,-,-,-
. 2010-10-13 02:24:45.250 SFTP Bugs: -,-
. 2010-10-13 02:24:45.250 Return code variable: Autodetect; Lookup user groups: Yes
. 2010-10-13 02:24:45.250 Shell: default
. 2010-10-13 02:24:45.250 EOL: 0, UTF: 2
. 2010-10-13 02:24:45.250 Clear aliases: Yes, Unset nat.vars: Yes, Resolve symlinks: Yes
. 2010-10-13 02:24:45.250 LS: ls -la, Ign LS warn: Yes, Scp1 Comp: No
. 2010-10-13 02:24:45.250 Local directory: default, Remote directory: home, Update: No, Cache: Yes
. 2010-10-13 02:24:45.250 Cache directory changes: Yes, Permanent: Yes
. 2010-10-13 02:24:45.250 DST mode: 1
. 2010-10-13 02:24:45.250 --------------------------------------------------------------------------
. 2010-10-13 02:24:45.250 Looking up host "sftp.abc123xyz.pdq.com"
. 2010-10-13 02:24:45.468 Connecting to 123.456.789.12 port 22
. 2010-10-13 02:24:45.500 Server version: SSH-2.0-GXSSSHD_Comments
. 2010-10-13 02:24:45.500 We believe remote version has SSH-2 ignore bug
. 2010-10-13 02:24:45.500 Using SSH protocol version 2
. 2010-10-13 02:24:45.500 We claim version: SSH-2.0-WinSCP_release_4.2.8
. 2010-10-13 02:24:45.515 Using Diffie-Hellman with standard group "group14"
. 2010-10-13 02:24:45.515 Doing Diffie-Hellman key exchange with hash SHA-1
. 2010-10-13 02:24:45.593 Server unexpectedly closed network connection


------------------------
-- LOG FOR SUCCESS
-------------------------






. 2010-10-13 11:38:33.265 --------------------------------------------------------------------------
. 2010-10-13 11:38:33.265 WinSCP Version 4.2.8 (Build 818) (OS 5.2.3790 Service Pack 2)
. 2010-10-13 11:38:33.265 Login time: Wednesday, October 13, 2010 11:38:33 AM
. 2010-10-13 11:38:33.265 --------------------------------------------------------------------------
. 2010-10-13 11:38:33.265 Session name: ABC123-SEND@sftp.abc123xyz.pdq.com
. 2010-10-13 11:38:33.265 Host name: sftp.abc123xyz.pdq.com (Port: 22)
. 2010-10-13 11:38:33.265 User name: ABC123-SEND (Password: Yes, Key file: No)
. 2010-10-13 11:38:33.265 Tunnel: No
. 2010-10-13 11:38:33.265 Transfer Protocol: SFTP (SCP)
. 2010-10-13 11:38:33.265 Ping type: -, Ping interval: 30 sec; Timeout: 15 sec
. 2010-10-13 11:38:33.265 Proxy: none
. 2010-10-13 11:38:33.265 SSH protocol version: 2; Compression: No
. 2010-10-13 11:38:33.265 Bypass authentication: No
. 2010-10-13 11:38:33.265 Try agent: Yes; Agent forwarding: No; TIS/CryptoCard: No; KI: Yes; GSSAPI: No
. 2010-10-13 11:38:33.265 Ciphers: aes,blowfish,3des,WARN,arcfour,des; Ssh2DES: No
. 2010-10-13 11:38:33.265 SSH Bugs: -,-,-,-,-,-,-,-,-
. 2010-10-13 11:38:33.265 SFTP Bugs: -,-
. 2010-10-13 11:38:33.265 Return code variable: Autodetect; Lookup user groups: Yes
. 2010-10-13 11:38:33.265 Shell: default
. 2010-10-13 11:38:33.265 EOL: 0, UTF: 2
. 2010-10-13 11:38:33.265 Clear aliases: Yes, Unset nat.vars: Yes, Resolve symlinks: Yes
. 2010-10-13 11:38:33.265 LS: ls -la, Ign LS warn: Yes, Scp1 Comp: No
. 2010-10-13 11:38:33.265 Local directory: default, Remote directory: home, Update: No, Cache: Yes
. 2010-10-13 11:38:33.265 Cache directory changes: Yes, Permanent: Yes
. 2010-10-13 11:38:33.265 DST mode: 1
. 2010-10-13 11:38:33.265 --------------------------------------------------------------------------
. 2010-10-13 11:38:33.265 Looking up host "sftp.abc123xyz.pdq.com"
. 2010-10-13 11:38:33.359 Connecting to 123.456.789.12 port 22
. 2010-10-13 11:38:33.390 Server version: SSH-2.0-GXSSSHD_Comments
. 2010-10-13 11:38:33.390 We believe remote version has SSH-2 ignore bug
. 2010-10-13 11:38:33.390 Using SSH protocol version 2
. 2010-10-13 11:38:33.390 We claim version: SSH-2.0-WinSCP_release_4.2.8
. 2010-10-13 11:38:33.406 Using Diffie-Hellman with standard group "group14"
. 2010-10-13 11:38:33.406 Doing Diffie-Hellman key exchange with hash SHA-1
. 2010-10-13 11:38:33.703 Host key fingerprint is:
. 2010-10-13 11:38:33.703 ssh-rsa 1024 3123e:5313213:d1:4234258:1:53453456db:36346346346634f:e63464681:a9
. 2010-10-13 11:38:33.703 Initialised AES-256 CBC client->server encryption
. 2010-10-13 11:38:33.703 Initialised HMAC-SHA1 client->server MAC algorithm
. 2010-10-13 11:38:33.703 Initialised AES-256 CBC server->client encryption
. 2010-10-13 11:38:33.703 Initialised HMAC-SHA1 server->client MAC algorithm
! 2010-10-13 11:38:33.890 Using username "ABC123-SEND".
. 2010-10-13 11:38:33.906 Prompt (6, SSH password, , &Password: )
. 2010-10-13 11:38:33.906 Using stored password.
. 2010-10-13 11:38:33.906 Sent password
. 2010-10-13 11:38:34.234 Access granted
. 2010-10-13 11:38:34.250 Opened channel for session
. 2010-10-13 11:38:34.671 Started a shell/command
. 2010-10-13 11:38:34.671 --------------------------------------------------------------------------
. 2010-10-13 11:38:34.671 Using SFTP protocol.
. 2010-10-13 11:38:34.671 Doing startup conversation with host.
> 2010-10-13 11:38:34.671 Type: SSH_FXP_INIT, Size: 5, Number: -1
< 2010-10-13 11:38:34.687 Type: SSH_FXP_VERSION, Size: 5, Number: -1
. 2010-10-13 11:38:34.687 SFTP version 3 negotiated.
. 2010-10-13 11:38:34.687 We believe the server has signed timestamps bug
. 2010-10-13 11:38:34.687 We will use UTF-8 strings for status messages only
. 2010-10-13 11:38:34.687 Getting current directory name.
. 2010-10-13 11:38:34.687 Getting real path for '.'
> 2010-10-13 11:38:34.687 Type: SSH_FXP_REALPATH, Size: 10, Number: 16
< 2010-10-13 11:38:34.703 Type: SSH_FXP_NAME, Size: 61, Number: 16
. 2010-10-13 11:38:34.703 Real path is '/ABC123-SEND'
. 2010-10-13 11:38:34.703 Startup conversation with host finished.
< 2010-10-13 11:38:34.703 Script: Active session: [1] ABC123-SEND@sftp.abc123xyz.pdq.com
> 2010-10-13 11:38:34.703 Script: CD ACCTRECON-AR3-A:/*BIN
. 2010-10-13 11:38:34.703 Cached directory change via "ACCTRECON-AR3-A:/*BIN" to "/ABC123-SEND/ACCTRECON-AR3-A:/*BIN".
. 2010-10-13 11:38:34.703 Getting current directory name.
< 2010-10-13 11:38:34.703 Script: /ABC123-SEND/ACCTRECON-AR3-A:/*BIN
> 2010-10-13 11:38:34.703 Script: option transfer binary
< 2010-10-13 11:38:34.703 Script: transfer binary
> 2010-10-13 11:38:34.703 Script: put D:\PSOFT\PSPRD\interfac\APPosPay\HOWDY-APPOSPAY-2010-10-13T02-24-43.txt
. 2010-10-13 11:38:34.703 Copying 1 files/directories to remote directory "/ABC123-SEND/ACCTRECON-AR3-A:/*BIN"
. 2010-10-13 11:38:34.703 PrTime: Yes; PrRO: No; Rght: rw-r--r--; PrR: No (No); FnCs: N; RIC: 01; Resume: S (102400); CalcS: No; Mask:
. 2010-10-13 11:38:34.703 TM: B; ClAr: No; CPS: 0; ExclM(No):
. 2010-10-13 11:38:34.703 AscM: *.*html; *.htm; *.txt; *.php; *.php3; *.cgi; *.c; *.cpp; *.h; *.pas; *.bas; *.tex; *.pl; .htaccess; *.xtml; *.css; *.cfg; *.ini; *.sh; *.xml
. 2010-10-13 11:38:34.703 File: "D:\PSOFT\PSPRD\interfac\APPosPay\HOWDY-APPOSPAY-2010-10-13T02-24-43.txt"
. 2010-10-13 11:38:34.718 Copying "D:\PSOFT\PSPRD\interfac\APPosPay\HOWDY-APPOSPAY-2010-10-13T02-24-43.txt" to remote directory started.
. 2010-10-13 11:38:34.718 Binary transfer mode selected.
. 2010-10-13 11:38:34.718 Opening remote file.
> 2010-10-13 11:38:34.718 Type: SSH_FXP_OPEN, Size: 100, Number: 259
< 2010-10-13 11:38:34.843 Type: SSH_FXP_HANDLE, Size: 33, Number: 259
> 2010-10-13 11:38:34.843 Type: SSH_FXP_WRITE, Size: 3705, Number: 774
> 2010-10-13 11:38:34.843 Type: SSH_FXP_CLOSE, Size: 33, Number: 1028
> 2010-10-13 11:38:34.843 Type: SSH_FXP_SETSTAT, Size: 96, Number: 521
< 2010-10-13 11:38:34.859 Type: SSH_FXP_STATUS, Size: 49, Number: 774
< 2010-10-13 11:38:34.859 Type: SSH_FXP_STATUS, Size: 40, Number: 1028
< 2010-10-13 11:38:34.859 Status code: 0
< 2010-10-13 11:38:34.859 Type: SSH_FXP_STATUS, Size: 40, Number: 521
< 2010-10-13 11:38:34.859 Status code: 0
> 2010-10-13 11:38:34.859 Script: close
. 2010-10-13 11:38:34.859 Closing connection.
. 2010-10-13 11:38:34.859 Sending special code: 12
. 2010-10-13 11:38:34.859 Sent EOF message
sluice
[View user's profile]

Joined: 2010-10-05
Posts: 9
I have found this and it looks as if it's down to a SAN setup error in our case. I can't give any mmore detail, but it means there has been an access blip and your link has broken. Once it's broken, you have to restart the session. Until the bug is fixed, the only way round it that I have found is to run your winscp.com batch file and script regularly (say every 30 minutes)using synchronize. My regular run is done with System Scheduler which has the advantage of running as a service.

Now, if WinSCP could give us something like an error level detect, we might be able to loop the winscp.com batch file and kick off the session and transfer again.
Guest




someone please help me.i'm using FTPShell client 3.5 from 2010 till now. never encountered any problem before. but, nowadays i've problem with generating log file. files are transferred but there is no record found in log file. it's a scheduled task. 1 day it works, the other day it's not.
Showrya

Guest


Hi all,

I am having the same problem logging it to one of my servers through Putty.

It prompts fro user name, then password. soon after entering the passwordd. I get the error "Server unexpectedily closed connection"

Please help me with this.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
Showrya wrote:
It prompts fro user name, then password. soon after entering the passwordd. I get the error "Server unexpectedily closed connection"

Please read http://winscp.net/eng/docs/message_unexpected_close
_________________
Martin Prikryl
Guftak

Guest


Hi, i'm using PowerShell with Winscpnet.dll, mi goal is get a file from an AIX server 6.1 , so i found an script in yours Examples (Thanks for that, becouse i'm newbie with PS) and adapted, so ramdomly times i got the error message "server unexpectedly closed network connection", my question is, i could have an example of re-connect script after that message with an x quantities of retries (sorry for my spell) for example re-try 3 more times?.

This is part of my script

try
{

#Cargar La Dll
Add-Type -path "d:\xyzn\xyz\WSCP\WinSCPnet.dll"
#Configurar datos de sesion
$sessionOptions = New-Object WinSCP.SessionOptions
$sessionOptions.Protocol = [WinSCP.Protocol]::Sftp
$sessionOptions.HostName = "1.1.1.1"
$sessionOptions.UserName = "xyz"
$SessionOptions.SshPrivateKeyPath = "d:\xyzn\xyz\WSCP\t_acme.ppk"
$sessionOptions.SshHostKeyFingerprint = "ssh-rsa 2048 ba:3d:99:dddd:0:4d:34:6c:121:1e:75:90"

$session = New-Object WinSCP.Session

try
{
#Conectarse
$session.Open($sessionOptions)

#Bajar archivo
$transferOptions = New-Object WinSCP.TransferOptions
$transferOptions.TransferMode = [WinSCP.TransferMode]::Automatic
$transferResult = $session.GetFiles( $PRemote + $NomArch, $Plocal, $False, $transferOptions)


#Comprobamos si hay errores
$transferResult.Check()

#Muestra Resultado
foreach ($transfer in $transferResult.Transfers)
{



if ( $transfer.Error -eq $Null )
{
#Write-Host ("Bajada de {0} succeeded" -f $transfer.FileName)
LogWrite ("Bajada de {0} succeeded" -f $transfer.FileName)
#Enviamos mail

if (test-path $sfile)
{

$From = """AXC"" acme@grupoacme.com"

[string[]]$Dest = "xyz@xxx.com"


[string[]]$Cco = "xyz@xxx.com"
[string[]]$Bmil = "xyz@xxx.com"

$smtpserver = "197.24.23.1"
$Subject = "Estado ACME"

#Con Out-String formateamos el texto

$body = Get-Content $sfile | Out-String;

$Cant = Get-Content $sfile | Measure-Object -line

# write-host $Cant.lines

$body2 = $style + (Get-Content $sfile | Select-Object -First 1 ) + "</FONT></P> &nbsp;"
# $body2 = $body2 + $style + (Get-Content $sfile)[2] + "</FONT></P>"
# $body2 = $body2 + $style + (Get-Content $sfile)[3] + "</FONT></P>"
# $body2 = $body2 + $style + (Get-Content $sfile)[4] + "</FONT></P>"
# $body2 = $body2 + $style + (Get-Content $sfile)[5] + "</FONT></P>"
# $body2 = $body2 + $style + (Get-Content $sfile)[6] + "</FONT></P>"
# $body2 = $body2 + $style + (Get-Content $sfile)[7] + "</FONT></P>"
# $body2 = $body2 + $style + (Get-Content $sfile)[8] + "</FONT></P>&nbsp;"

for ( $i=2; $i -le 8; $i++)
{
$body2 = $body2 + $style + (Get-Content $sfile)[$i] + "</FONT></P>"
}
$body2 = $body2 + $style + (Get-Content $sfile)[10] + "</FONT></P>"

for ( $i=11; $i -le $Cant.lines; $i++)
{
$body2 = $body2 + $sstyle + ((Get-Content $sfile)[$i] -replace " ", "&nbsp;") + "</FONT></P>"
}

$body2 = $body2 + $style3 + $style3
$body2 = $body2 + $style4 + "<STRONG>Acme</STRONG></FONT></P>"
$body2 = $body2 + $style4 + "IT Acme deparment"
$body2 = $body2 + "monitor</FONT></P>"
$body2 = $body2 + $style4 + "Acme</FONT></P>"
$body2 = $body2 + $style4 + "Tel: (+52)(11) 888888888 Int: "
$body2 = $body2 + "7193/81/82</FONT></P>"
$body2 = $body2 + $style3
$body2 = $body2 + $style5 + "<STRONG>:: Por favor, piense en el medio ambiente "
$body2 = $body2 + "antes de imprimir este mensaje ::</STRONG></FONT></P>"



$enc = New-Object System.Text.utf8encoding


# foreach ($recipient in $to)
#{
#write-host "Enviando mail a $to"
LogWrite "Enviando mail a $to"
#Send-MailMessage -smtpServer $smtpserver -from $from -to $recipient -cc $Cco -bcc $Bmil -subject $subject -body $body2 –BodyAsHtml -encoding $enc
Send-MailMessage -smtpServer $smtpserver -from $from -to $Dest -cc $Cco -bcc $Bmil -subject $subject -body $body2 –BodyAsHtml -encoding $enc
LogWrite "Eliminando archivo"
Remove-Item $sfile
# }

}
else
{
#write-host "Archivo " + $file + " no encontrado "
LogWrite "Archivo " + $file + " no encontrado "
}
}
else
{
#writ-host ("Bajada de Archivo {0} fallo: {1}" -f
LogWrite ("Bajada de Archivo {0} fallo: {1}" -f
$transfer.FileName, $transfer.Error.Message )
#$transfer.FileName, $transfer.Error.Message )
}
}

}
finally
{
# Disconnect, clean up
$session.Dispose()
}

exit 0

}

catch [Exception]
{
Write-Host $_.Exception.Message
LogWrite $_.Exception.Message
exit 1
}
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License