Winscp network error connection refused

I am using the WinSCP in order to download files using FTP protocol. I got this error in the XML log. Any idea? Network error: Connection to "example.com" refused. The server rejected

I am using the WinSCP in order to download files using FTP protocol.

I got this error in the XML log. Any idea?

Network error: Connection to «example.com» refused.
The server rejected SFTP connection, but it listens for FTP connections.

Did you want to use FTP protocol instead of SFTP? Prefer using
encryption.

Martin Prikryl's user avatar

asked Apr 23, 2014 at 10:52

user3548593's user avatar

WinSCP uses SFTP protocol by default, contrary to most other file transfer clients, which use FTP protocol.

For this reason, when you try to connect using the default SFTP protocol to a server that does not have an SSH/SFTP service (does not have a port 22 open), but it has an FTP service (a port 21 open), it suggests you that you might have actually wanted to use the FTP.

You need to select the FTP protocol explicitly on Login dialog:
https://winscp.net/eng/docs/ui_login

For more details:
https://winscp.net/eng/docs/message_server_rejected_sftp_listens_for_ftp

answered Apr 23, 2014 at 12:44

Martin Prikryl's user avatar

Martin PrikrylMartin Prikryl

181k53 gold badges461 silver badges933 bronze badges

4

Even if all these protocols have similar names they are different:

  • FTP — file transfer protocol RFC959
  • SFTP — «secure file transfer», which is file transfer over a SSH connection
  • SCP — «secure copy», also file transfer over SSH
  • FTPS — «FTP secure», an extension of the original FTP with use of SSL (not SSH) connections

So SFTP and SCP need an SSH server at the peer, while FTP/FTPS need an FTP(s) server.

WinSCP can probably all of these, but it can only do FTPS if the FTP server has the SSL extension enabled. So if you want to do FTPS (and not SFTP) please check your servers configuration.

Martin Prikryl's user avatar

answered Apr 23, 2014 at 11:14

Steffen Ullrich's user avatar

Steffen UllrichSteffen Ullrich

110k10 gold badges129 silver badges167 bronze badges

1

Network Error: Connection Refused problem

  • Log in

Advertisement

MicroMoth
Joined:
2006-04-11
Posts:
2

2006-04-18 11:50

Hi,

I cannot log into WinSCP, everytime I try I get the Network Error: Connection Refused error. The Firewall is set up to allow access on Port 22, but I’m still getting this error message.

What could be causing this error when the firewall is open to traffic on Port 22?

Advertisement

martin◆

Site Admin
martin avatar
Joined:
2002-12-10
Posts:
38,466
Location:
Prague, Czechia

2006-04-19

Can you connect with another SSH client? What firewall do you mean, the one on local or remote side? Also note that some local firewalls can block connection based on application, not only port.

stamfordblue
Joined:
2006-04-19
Posts:
1

2006-04-19 23:17

I get the same error. I have a remote server which I can access fine via remote desktop but when I enter the IP address, username and password (after ensuring my local firewall allows winscp access) I get the connection refused message.

Help!!!

martin◆

Site Admin
martin avatar
Joined:
2002-12-10
Posts:
38,466
Location:
Prague, Czechia

2006-04-20

I get the same error. I have a remote server which I can access fine via remote desktop but when I enter the IP address, username and password (after ensuring my local firewall allows winscp access) I get the connection refused message.

Help!!!

Remote desktop uses another port. Port 22 used by SSH can ble blocked. Also are you sure that there is SSH server running on the server?

Guest

2006-05-02 13:37

MicroMoth wrote:

Hi,

I cannot log into WinSCP, everytime I try I get the Network Error: Connection Refused error. The Firewall is set up to allow access on Port 22, but I’m still getting this error message.

What could be causing this error when the firewall is open to traffic on Port 22?

I have the same problem as written before. We are using local firewalls on workstations. My question is whether WinSCP using a callback method which needs an open port at the caller’s (client) side? If so, is the application using a fixed port for callback or does it use a port in a range or is it a totally random port? I cannot set the desktop firewalls to accept all traffic from all of our servers, because it would be too much.

Advertisement

martin◆

Site Admin
martin avatar
Joined:
2002-12-10
Posts:
38,466
Location:
Prague, Czechia

2006-05-02

I have the same problem as written before. We are using local firewalls on workstations. My question is whether WinSCP using a callback method which needs an open port at the caller’s (client) side? If so, is the application using a fixed port for callback or does it use a port in a range or is it a totally random port? I cannot set the desktop firewalls to accept all traffic from all of our servers, because it would be too much.

There’s no callback method. There is only one outgoing connection, typically to port 22.

gast

Guest

2006-05-04 13:09

Sorry for my english, I am german.

I have the same problems.

With 2 other FTP-clients I get connect to all my server (6 x windows / 4 x Linux)

With WinSCP Version 3.7.6 (Build 306)

I have only a connet to a Linux-Server,

all the other (the rest) is an error like

Network Error: Connection Refused

Any ideas for help?

martin◆

Site Admin
martin avatar

2006-05-05

gast wrote:

With 2 other FTP-clients I get connect to all my server (6 x windows / 4 x Linux)

Do you use SFTP or FTP protocol with the «other FTP-clients»?

gasr

Guest

2006-05-08 08:04

martin wrote:

gast wrote:

With 2 other FTP-clients I get connect to all my server (6 x windows / 4 x Linux)

Do you use SFTP or FTP protocol with the «other FTP-clients»?

Sorry for my late replay.

both WS_FTP and ftp-uploader use FTP protocol, i think so.

Advertisement

martin◆

Site Admin
martin avatar

2006-05-09

gasr wrote:

both WS_FTP and ftp-uploader use FTP protocol, i think so.

And do you know if there is SSH service at all on the server?

opus2295

Guest

2006-12-23 00:21

If you are having problems connecting to a Linux server, make sure taht the server is running OPENSSH SERVER or equivalent. I just assumed that Automatix installed all this guff, but it doesn’t.

In Ubuntu, check Synaptic for what has been installed in SSH. I added OPENSSH SERVER and WinSCP now connects.

jamesjiao
Joined:
2007-01-12
Posts:
1

2007-01-12 06:23

I thought I’d simply reply to this thread instead of opening a brand new one on a similar issue.

Ok,

I have IPCop (a linux based server/router/proxy Operating system) installed on a gateway PC that regulates network traffic on my home network with default configurations. Now According to IPCop’s official site, I am supposed to use WinSCP to transfer files to the IPcop box from my admin workstation. It did not mention anything about turning any service on/off on IPcop box. Keep in mind that both boxes (ipcop and admin ws) are visible on the same subnet. I can ping from admin ws to Ipcop and vice versa

When I connect, I use IPcop’s root password and port 22 (default). It comes back with Network error: Connection refused. Note also that I am unable to connect to the IPcop box with Putty either, same error message, just so you know.

I can post the log when I get home if you like.

martin◆

Site Admin
martin avatar
Joined:
2002-12-10
Posts:
38,466
Location:
Prague, Czechia

2007-01-12

jamesjiao wrote:

When I connect, I use IPcop’s root password and port 22 (default). It comes back with Network error: Connection refused. Note also that I am unable to connect to the IPcop box with Putty either, same error message, just so you know.

Either the SSH interface on the IPcop is not running or there is some firewall on the way preventing the connection.

Advertisement

Guest

2007-01-12 11:06

martin wrote:

jamesjiao wrote:

When I connect, I use IPcop’s root password and port 22 (default). It comes back with Network error: Connection refused. Note also that I am unable to connect to the IPcop box with Putty either, same error message, just so you know.

Either the SSH interface on the IPcop is not running or there is some firewall on the way preventing the connection.

You are right… I just discovered that i need to turn on SSH on ipcop.. Thanks for the help. All is working..

kudin

Guest

2007-08-08 11:01

jamesjiao wrote:

I thought I’d simply reply to this thread instead of opening a brand new one on a similar issue.

Ok,

I have IPCop (a linux based server/router/proxy Operating system) installed on a gateway PC that regulates network traffic on my home network with default configurations. Now According to IPCop’s official site, I am supposed to use WinSCP to transfer files to the IPcop box from my admin workstation. It did not mention anything about turning any service on/off on IPcop box. Keep in mind that both boxes (ipcop and admin ws) are visible on the same subnet. I can ping from admin ws to Ipcop and vice versa

When I connect, I use IPcop’s root password and port 22 (default). It comes back with Network error: Connection refused. Note also that I am unable to connect to the IPcop box with Putty either, same error message, just so you know.

I can post the log when I get home if you like.

1. You must create rule for admin, and put in the SSH protocol to use port 222 in your IPCop.

2. Giving allow to access using ip address between your ipcop and your pc (only act as admin).

3. Set again on your WinSCP but using port 222 and logon username and password root.

steve-fr

Guest

2007-08-25 17:27

kudin wrote:

jamesjiao wrote:

I thought I’d simply reply to this thread instead of opening a brand new one on a similar issue.

Ok,

I have IPCop (a linux based server/router/proxy Operating system) installed on a gateway PC that regulates network traffic on my home network with default configurations. Now According to IPCop’s official site, I am supposed to use WinSCP to transfer files to the IPcop box from my admin workstation. It did not mention anything about turning any service on/off on IPcop box. Keep in mind that both boxes (ipcop and admin ws) are visible on the same subnet. I can ping from admin ws to Ipcop and vice versa

When I connect, I use IPcop’s root password and port 22 (default). It comes back with Network error: Connection refused. Note also that I am unable to connect to the IPcop box with Putty either, same error message, just so you know.

I can post the log when I get home if you like.

1. You must create rule for admin, and put in the SSH protocol to use port 222 in your IPCop.

2. Giving allow to access using ip address between your ipcop and your pc (only act as admin).

3. Set again on your WinSCP but using port 222 and logon username and password root.

Hi,

can you please explain in details:

1 — how to create rule for admin??

2 — Giving allow to access using ip address between your ipcop and your pc??

guest

Guest

2007-10-22 20:45

The default ssh port for Ipcop is actually 222

change this in your winscp settings , and see what happens, you may be pleasantly surprised :)

Farr

Advertisement

Guest

2007-12-18 04:56

Anonymous wrote:

martin wrote:

jamesjiao wrote:

When I connect, I use IPcop’s root password and port 22 (default). It comes back with Network error: Connection refused. Note also that I am unable to connect to the IPcop box with Putty either, same error message, just so you know.

Either the SSH interface on the IPcop is not running or there is some firewall on the way preventing the connection.

You are right… I just discovered that i need to turn on SSH on ipcop.. Thanks for the help. All is working..

thanks very much for all recommends

denys82

Guest

2008-01-25 05:59

I downloaded the WinSCP in my laptop. My computer has windows vista by the way.

I am having problems login in. I save my host name and the other details but it keeps on sending me the Network error : conection refused.

I turned off my firewall and I included the program to the allowed program too.

There are other two options in Network and Sharing Center about sharing or not sharing files but on or off it doesnt let my computer log in.

What should I do. I can not connect putty either.

I hope someone can help me.

Thanks

martin◆

Site Admin
martin avatar

2008-01-25

denys82 wrote:

I am having problems login in. I save my host name and the other details but it keeps on sending me the Network error : conection refused.

Are you sure you are using correct protocol? SSH (SFTP/SCP) vs. FTP?

denys82

Guest

2008-01-28 17:00

Yes, I used the right protocol

It seems that something else is protecting for connecting.

Is there is any other way for me to access my serve and transfer documents from my computer?

Advertisement

martin◆

Site Admin
martin avatar

2008-01-30

denys82 wrote:

Is there is any other way for me to access my serve and transfer documents from my computer?

That is question for your server administrator.

martin◆

Site Admin
martin avatar

2008-02-13

For overview of possible reasons of getting refused to connect, please refer to documentation

Ameeran

Guest

2008-05-05 22:04

You need to have a jailbroken ipod and download/install a package from installer called «OpenSSH», thats what i did and it works perfectly now, also you have to be connected to the internet aswell, dont really know why though.

yahknowa

Guest

2008-05-18 19:37

Hi

Sorry, I’m a newbie but made much progress, but receiving same problem since I am attempting log-in but receive same message. I have my WI-FI connected and IPOD 1.1.4 «with» SSH but can’t log in!!! I am using Windows XP and followed everything you mentioned but can’t access my iPod thru my desktop.

I cannot log into WinSCP, everytime I try I get the Network Error: Connection Refused error. The Firewall is set up to allow access on Port 22, but I’m still getting this error message.

What could be causing this error when the firewall is open to traffic on Port 22?

Advertisement

martin◆

Site Admin
martin avatar

2008-05-21

yahknowa wrote:

What could be causing this error when the firewall is open to traffic on Port 22?

You should better seek advice on iPod-related forum.

helpmepleeze

Guest

2008-05-25 19:37

i got the sqame problem as every one here. net doesnt want to connect after i login. ssh everything is correctly done. what to do …… pleeeeeze help

Henry

Guest

2008-05-26 17:00

I used WinSCP to access a IPCOP box and it worked very fine,

but since I updated the client machine, running Windows XP, to Service Pack 3, I get this error.

I updated WinSCP to latest version, but there’s no way.

The problem is not the IPCOP box, but something in XP SP3 that blocks WinSCP.

Any suggestion?

Thanks in advance.

martin◆

Site Admin
martin avatar
Joined:
2002-12-10
Posts:
38,466
Location:
Prague, Czechia

2008-05-26

Henry wrote:

I used WinSCP to access a IPCOP box and it worked very fine,

but since I updated the client machine, running Windows XP, to Service Pack 3, I get this error.

I updated WinSCP to latest version, but there’s no way.

The problem is not the IPCOP box, but something in XP SP3 that blocks WinSCP.

Have you read this FAQ?

Advertisement

Henry

Guest

2008-05-27 22:47

Yes, I read and understood it.

But Windows firewall on the client is disabled and, just to be safer, I set up an exception for WinSCP.

I’m also connecting to the correct port on the IPCOP box for SSH, which is 222 instead of standard 22.

I repeat, everything was working fine before I upgraded XP to SP3, I think there’s something in the upgrade which blocks WinSCP, but I can’t get out of it.

Any suggestion would be helpful, thanks.

martin◆

Site Admin
martin avatar

2008-05-30

gerald

Guest

2008-06-28 02:26

I have also discovered a problem with XP SP3 and connection refused. Correct port to IPCop 222. Correct subnet address. SSH enabled. The Network Access Protection service is not running. Switched hard drives with SP1 running and it works fine. Just like Henry mentioned there has been a change in SP3 that does not allow the connection. I also use Total Commander for file management with file shares on other pc’s without issue. To maintain my website, I use Total Commander’s FTP client and have no issue connecting to Comcast webserver.

Can not find anyway to correct this issue. For now I use another machine that is running XP SP1 to connect to IPCop until this issue is resolved.

Any help would be appreciated. There has to be a way to get around this problem. Thanks.

sumayya

Guest

2009-01-26 15:15

hi!

i am using vmware on my XP SP3 as host machine and RedHat 9 on guest machine

i want to make these two machines communicate through winscp..

so i assigned my guest OS static IP and tried to communicate

but again same error as stated above came of Connection Refused

can u please help me figure out the problem.. i really want these two machine to conect so that i can continue my work

thanks!

Advertisement

Shaik

Guest

2009-06-16 08:20

opus2295 wrote:

If you are having problems connecting to a Linux server, make sure taht the server is running OPENSSH SERVER or equivalent. I just assumed that Automatix installed all this guff, but it doesn’t.

In Ubuntu, check Synaptic for what has been installed in SSH. I added OPENSSH SERVER and WinSCP now connects.

thank you, this suggestion helped

seth

Guest

2009-07-07 20:25

Download Open SSH via cydia and it should solve your problem….it solved mine

fool

Guest

2009-07-13 22:36

Sorry guys, but I have this kind of problem as well:

I’m trying to access a linux server via WinSCP from WinXP and it works perfectly fine with Putty, but WinSCP always gives me Network error: Connection Refused.

I also tried with my firewall turned off and there should not be any proxies in the way.

Thanks!

martin◆

Site Admin
martin avatar
Joined:
2002-12-10
Posts:
38,466
Location:
Prague, Czechia

2009-07-15

fool wrote:

Sorry guys, but I have this kind of problem as well:

I’m trying to access a linux server via WinSCP from WinXP and it works perfectly fine with Putty, but WinSCP always gives me Network error: Connection Refused.

I also tried with my firewall turned off and there should not be any proxies in the way.

Thanks!

Can you post a log file both from PuTTY and WinSCP? Please create new thread for this.

Advertisement

anaagrawal

Guest

2009-08-18 13:31

Try installing sshserver and client

1)sudo apt-get install openssh-server

2)sudo apt-get install openssh-client

my problem got solvd with this…

Prikolist

Guest

2009-09-06 21:29

I got same error

my provider closed port 22 — can it be reason?

martin◆

Site Admin
martin avatar

2009-09-07

Reposting reference to documentation on the error and closing this topic. Please start new thread if you are having another problem not dealt with in the documentation.

Advertisement

  • Log in

This topic is locked: you cannot edit posts or make replies

The server’s host key was not found in the cache

This error message occurs when WinSCP connects to a new SSH server. Every server identifies itself by means of a host key; once WinSCP knows the host key for a server, it will be able to detect if a malicious attacker redirects your connection to another machine. If you see this message, it means that WinSCP has not seen this host key before, and has no way of knowing whether it is correct or not. You should attempt to verify the host key by other means, such as asking the machine’s administrator. If you see this message and you know that your installation of WinSCP has connected to the same server before, it may have been recently upgraded to SSH protocol version 2. SSH protocols 1 and 2 use separate host keys, so when you first use SSH-2 with a server you have only used SSH-1 with before, you will see this message again. You should verify the correctness of the key as before.1)

Warning — Potential security breach!

This message, followed by “The server’s host key does not match the one WinSCP has is cache”, means that WinSCP has connected to the SSH server before, knows what its host key should be, but has found a different one. This may mean that a malicious attacker has replaced your server with a different one, or has redirected your network connection to their own machine. On the other hand, it may simply mean that the administrator of your server has accidentally changed the key while upgrading the SSH software; this shouldn’t happen but it is unfortunately possible. You should contact your server’s administrator and see whether they expect the host key to have changed. If so, verify the new host key in the same way as you would if it was new.

Network error: Connection refused

You may get this message when connecting to a server for following reasons:

  • You are trying to use WinSCP for a purpose for which it is not designed. WinSCP needs a SSH or FTP server to be installed at the other end (on the machine you want to connect to). In particular, you cannot easily use it to connect to another Windows workstation, since Windows does not have an SSH or FTP server included by default. Please refer to FAQ.
  • You are trying to use protocol that the server does not support. Particularly you are trying SFTP/SCP (over SSH), but the server supports FTP; or vice versa. Check selected protocol on login dialog. Note that WinSCP defaults to SFTP protocol, while most other similar applications default to FTP.
  • The server is running on non-standard port. Please make sure you enter actual port number on login dialog.
  • You may need to connect through proxy server, but you have not specified one on login dialog.
  • Connection was blocked by firewall. Please refer to FAQ.

No connection could be made because the target machine actively refused it

The same as «Network error: Connection refused».

Network error: Connection timed out

All reasons and hints for «Network error: Connection refused» apply to this error too.

Network error: No route to host

All reasons and hints for «Network error: Connection refused» apply to this error too. It may also be worth trying again later as this error can be due to temporary network issue.

Timeout detected

If you are getting the error while logging in or while initiating file transfer, all reasons and hints for «Network error: Connection refused» apply to this error too.

Network error: Software caused connection abort

While Connecting

You may get this message when connecting to a server for following reasons:

  • Connection was blocked by firewall.
  • All reasons and hints for «Server unexpectedly closed network connection» apply to this error too.

In a Middle of Session

If you are getting the error in the middle of session, it means that Windows network code killed an established connection for some reason. For example, it might happen if you pull the network cable out of the back of an Ethernet-connected computer, a DHCP IP address renewal fails or changes the computer’s IP address, or if Windows has any other similar reason to believe the entire network has become unreachable.

Windows also generates this error if it has given up on the machine at the other end of the connection ever responding to it. If the network between your client and files server goes down and your client then tries to send some data, Windows will make several attempts to send the data and will then give up and kill the connection. In particular, this can occur even if you didn’t do anything, if you are using SSH-2 and WinSCP attempts a key re-exchange.

The problem can be caused also by the firewall. Try to disable it temporarily to see if the problem persists. Refer to FAQ.

It can also occur if you are using keepalives in your connection. Other people have reported that keepalives fix this error for them.

If you find DHCPNACK errors in the Event Viewer, your DHCP server may be briefly denying your IP address, causing your existing connections to fail. Where possible, this can be addressed by reserving a specific IP address on the DHCP server (e.g. cable modem/router), setting that as the static IP address, and disabling the DHCP client service.

Host does not exist

You may get this message when connecting to a server for following reasons:

  • You may have typed a wrong hostname on Login dialog.
  • Your domain name is new and is not fully distributed to DNS servers yet.
  • Connection was blocked by firewall.
  • Problem with DNS server.

Common mistake is to enter full URL (e.g. ftp://ftp.example.com) as hostname on Login dialog instead of actual hostname (e.g. ftp://ftp.example.com).

The requested name is valid, but no data of the requested type was found

All reasons and hints for «Host does not exist» apply to this error too.

General failure; Error code: 4

Particularly for “General failure”, the SFTP server should provide you more details, that you will see next to “Error message from server”. Unfortunately, SFTP server shipped with OpenSSH (or Sun SSH) does not. That is, why you see there just “Failure” (very useful).
Some situations when OpenSSH (Sun SSH) server issues this useless error message:

  • Renaming file to name of already existing file.
  • Creating directory that already exists.
  • Moving remote file to different filesystem (HDD).
  • Uploading file to full filesystem (HDD).
  • Exceeding user disk quota.

If none of the above helps, check your permissions or contact server administrator.

Server unexpectedly closed network connection

While Connecting

If you get this error message while connecting to your server, it is most usually caused by the server not being able to run some process necessary to support your session. Possibilities are:

  • Shell.
    • Your account may not be allowed to start a shell at all. With some servers (like OpenSSH or Sun SSH), you may need to be allowed to start a shell, even if using SFTP protocol.
    • Also some servers refuse to start a shell if your password has expired or your account was terminated.
    • Some shells do not work with non-interactive sessions. The same it true for some configurations (or profiles used) for otherwise working shells. This commonly exhibits with SCP protocol with associated error message «Error skipping startup message. Your shell is probably incompatible with the application (BASH is recommended).» Try to force bash shell explicitly on SCP/Shell tab of Login dialog. Using SFTP protocol instead of SCP is another option.
    • OpenSSH server may fail to start shell when chroot is configured, but not possible (e.g. due to permissions).
  • SFTP server.
    • Your account may not be able to start SFTP server binary (e.g. /bin/sftp-server) or the binary is not present on your server. Your SSH server may also lack the SFTP subsystem.

In a Middle of Session

If you get this error message in a middle of the session, it is usually caused by some fatal error on server. The server error may possibly be initiated by error on client (WinSCP) side.

In both cases check log file of your server to see an actual reason, it closed connection for.

Connection has been unexpectedly closed. Server sent command exit status 1 (or 255 or 0)

All reasons and hints for «Server unexpectedly closed network connection» apply to this error too.

Network error: Connection reset by peer

All reasons and hints for «Server unexpectedly closed network connection» apply to this error too.

Host is not communicating for more than 15 seconds. Still waiting… Warning: Aborting this operation will close connection!

You get this message when WinSCP is waiting for response from the server for more than configured time. Note that this is not an error message, WinSCP still keeps waiting. If the server responds finally, the message goes away automatically. The message box is shown only to give you a chance to break the connection and reconnect, if you do not want to wait anymore. If the server never replies, it may be because of some fatal error on the server side. Also something may be interfering with the connection, preventing the server response from arriving or possibly even the original request to arrive at the server.

Access denied

You will get the error while authenticating when:

  • You have entered incorrect password, used used non-authorized key, etc.
  • The account you are trying to use cannot be logged in. This can be case even when you get “Access denied” only after entering password, as for security reasons, many servers do not reveal information about the accounts. Reasons for not being allowed to login include:
    • The account (username) you have entered on Login dialog does not exist at all.
    • The account is disabled.
    • The password has expired.
    • Number of parallel sessions allowed for the account has been exceeded.
    • You are trying to connect with super-user account (root), without having allowed that. Please read FAQ.

It may help to check log file of your server to see an actual reason, it denied you an access.

Permission denied

You do not have a sufficient permissions (access rights) to a resource, such as a file or directory, to perform the operation. You should contact the server administrator to resolve the problem. Access rights systems differ with operating system and the file server. With the most common combination of Unix-based system and OpenSSH:

  • To see a directory contents you need to have read permissions to the directory;
  • To read a file you need to have read permissions to the file;
  • To write a file you need to have a write permissions to the file;
  • To create or delete file you need have a write permissions to the directory;
  • To change file or directory permissions you need to be its owner;
  • To change file modification time you need to its owner.

Server sent disconnect message type 2 (protocol error): «Too many authentication failures for root»

This message is produced by an OpenSSH (or Sun SSH) server if it receives more failed authentication attempts than it is willing to tolerate. This can easily happen if you are using Pageant and have a large number of keys loaded into it, since these servers count each offer of a public key as an authentication attempt. This can be worked around by specifying the key that’s required for the authentication in the session configuration; WinSCP will ignore any other keys Pageant may have, but will ask Pageant to do the authentication, so that you don’t have to type your passphrase.

Unable to use this private key file, Couldn’t load private key, Key is of wrong type

If you see one of these messages, it often indicates that you’ve tried to load a key of an inappropriate type into WinSCP. You may have specified a key that’s inappropriate for the connection you’re making. The SSH-1 and SSH-2 protocols require different private key formats, and a SSH-1 key can’t be used for a SSH-2 connection (or vice versa). Alternatively, you may have tried to load an SSH-2 key in a “foreign” format (OpenSSH or ssh.com), in which case you need to import it into PuTTY’s native format.

Unexpected directory listing line ‘…’

You will get the error with SCP protocol, if output of ls command cannot be parsed by WinSCP. WinSCP expects listing in format:

<type><permissions> <inode> <owner> <group> 
<size> <timestamp> <filename>[ -> <target>]

Some common examples:

drw-r--r--  3 martinp users  4596 2007-06-06 11:18:33.000000000 +0200 private
lrwxrwxrwx  1 martinp users     4 Mar 24  2005 wiki -> dokuwiki
drwxr-xr-x+ 2 martinp users    96 Oct 26 14:58 httpdocs

If your listing does not correspond to some of the above:

  • Try using SFTP protocol instead of SCP.
  • Always make sure you are using the latest version of WinSCP, as support for different listing format is being added continuously.
  • Alter output of ls command to match any of the supported formatting. WinSCP has few session options that may be used for that, including:
    • Listing command (e.g. use sed to modify output of ls command to match the WinSCP requirements);
    • Clear aliases (may help if the ls command is aliased to display non standard output) and
    • Clear national variables (may help if your listing does not use english month names).

  • Make sure you are using bash shell. If you do not want to set it as your default shell, force it for WinSCP sessions.

Received too large (… B) SFTP packet. Max supported packet size is 102400 B

The problem is typically caused by a message printed from some profile/logon script. It violates the SFTP protocol. Some of these scripts are executed even for non-interactive (no TTY) sessions, so they cannot print anything (nor ask user to type something). The number … represents the first four bytes read from the server. If your login scripts are printing words, this will be the first four characters cast into a number, and not an SFTP message at all. To fix the problem find out what command in your login script prints text. Once you find it move the command to the proper interactive script, or remove it entirely. The scripts are usually hidden (their name starts with dot) and are located in your home directory on the server. There are other possible sources of the message in addition to the profile script — some SSH servers print messages if they are unable to start the SFTP server, or encounter a fatal error. You should contact your server administrator. Another possibility is that the server is configured to only allow the SCP protocol and not the SFTP protocol, in such a way that SCP fallback mechanism of WinSCP does not work. The solution is to choose SCP protocol on the login dialog.

Command failed with return code 127 (or 255)

You will get the error with SCP protocol, if command necessary for facilitate operation you were trying to do does not exist on remote server or the shell cannot find it. If you are not an experienced Unix user, you should first try using SFTP protocol instead. If you are sure that the command exists on the remote server, make sure that WinSCP (or rather the shell) can find it. You may need to add path to the command to PATH environment variable. Also make sure that the startup script that sets PATH is actually executed for non-interactive sessions. You can also try to run the respective command from terminal (with the same account that you use with WinSCP), to verify that you can execute it. You may not have sufficient permissions, or the command dependencies may not be installed. Common situations, in which you may get the error:

  • Transferring files fails, because path to scp command is not in PATH;
  • Error appears while logging in, because your *nix distribution lacks groups command. You can instruct WinSCP not to use the command in session settings.

Error skipping startup message. Your shell is probably incompatible with the application (BASH is recommended)

This error is typically associated with another error. If there is no other error in the message, try searching a log file.

Server returned empty listing for directory

Check that you have read and execute permissions to the directory.

Timeout waiting for external console to complete the command

This error indicates that winscp.exe did not receieve an answer from winscp.com in time. Most commonly this happens when winscp.com has redirected output to a stream with limited buffer. If the stream is not being read from, the buffer gets eventually filled and winscp.com hangs, when trying to write into it. In turn the above most commonly happens when winscp.com is run from another program (such as .Net code), which redirect its output into stream. If the program then e.g. waits for winscp.com to finish without reading from the stream, the winscp.com eventually hangs, never finishing. See example of .Net or WSH code dealing with the problem.

Error listing directory

This is high-level error, and it is typically associated with another error, such as:

  • Timeout detected;
  • Unexpected directory listing line ‘…’.

Invalid access to memory

This error message is not useful for you as an end-user. It generally means that there is a bug in the software. Please report the bug.

I am using the WinSCP in order to download files using FTP protocol.

I got this error in the XML log. Any idea?

Network error: Connection to «example.com» refused.
The server rejected SFTP connection, but it listens for FTP connections.

Did you want to use FTP protocol instead of SFTP? Prefer using
encryption.

Martin Prikryl's user avatar

asked Apr 23, 2014 at 10:52

user3548593's user avatar

WinSCP uses SFTP protocol by default, contrary to most other file transfer clients, which use FTP protocol.

For this reason, when you try to connect using the default SFTP protocol to a server that does not have an SSH/SFTP service (does not have a port 22 open), but it has an FTP service (a port 21 open), it suggests you that you might have actually wanted to use the FTP.

You need to select the FTP protocol explicitly on Login dialog:
https://winscp.net/eng/docs/ui_login

For more details:
https://winscp.net/eng/docs/message_server_rejected_sftp_listens_for_ftp

answered Apr 23, 2014 at 12:44

Martin Prikryl's user avatar

Martin PrikrylMartin Prikryl

181k53 gold badges461 silver badges933 bronze badges

4

Even if all these protocols have similar names they are different:

  • FTP — file transfer protocol RFC959
  • SFTP — «secure file transfer», which is file transfer over a SSH connection
  • SCP — «secure copy», also file transfer over SSH
  • FTPS — «FTP secure», an extension of the original FTP with use of SSL (not SSH) connections

So SFTP and SCP need an SSH server at the peer, while FTP/FTPS need an FTP(s) server.

WinSCP can probably all of these, but it can only do FTPS if the FTP server has the SSL extension enabled. So if you want to do FTPS (and not SFTP) please check your servers configuration.

Martin Prikryl's user avatar

answered Apr 23, 2014 at 11:14

Steffen Ullrich's user avatar

Steffen UllrichSteffen Ullrich

110k10 gold badges129 silver badges167 bronze badges

1

I ssh to EC2 all the time, using both PuTTY and WinSCP. I recently discovered the Commands > Open in PuTTY function in WinSCP, however it does not seem to work. When connecting I get this error (PuTTY):

Network error: Connection refused

And this is the error in PuTTY’s event log:

2018-05-23 22:40:11 Connecting to ::1 port 22
2018-05-23 22:40:11 We claim version: SSH-2.0-PuTTY_Release_0.70
2018-05-23 22:40:12 Failed to connect to ::1: Network error: Connection refused
2018-05-23 22:40:12 Connecting to 10.8.x.x port 22
2018-05-23 22:40:13 Failed to connect to 10.8.x.x: Network error: Connection refused
2018-05-23 22:40:13 Connecting to 192.168.x.x port 22
2018-05-23 22:40:14 Failed to connect to 192.168.56.1: Network error: Connection refused
2018-05-23 22:40:14 Connecting to 192.168.x.x port 22
2018-05-23 22:40:15 Failed to connect to 192.168.x.x: Network error: Connection refused
2018-05-23 22:40:15 Network error: Connection refused

(IP addresses partially redacted with x.x)

Clearly the issue is with the IP it is connecting to (first line)

2018-05-23 22:40:11 Connecting to ::1 port 22

This is how a working event log looks like:

2018-05-23 22:44:01 Connecting to o.o.o.o port 22
2018-05-23 22:44:01 We claim version: SSH-2.0-PuTTY_Release_0.70
2018-05-23 22:44:01 Server version: SSH-2.0-OpenSSH_7.2p2 Ubuntu-4ubuntu2.4
2018-05-23 22:44:01 Using SSH protocol version 2
2018-05-23 22:44:01 Doing ECDH key exchange with curve Curve25519 and hash SHA-256
2018-05-23 22:44:02 Server also has ecdsa-sha2-nistp256/ssh-rsa host keys, but we don't know any of them
2018-05-23 22:44:02 Host key fingerprint is:
2018-05-23 22:44:02 ssh-ed25519 256 <removed>
2018-05-23 22:44:02 Initialised AES-256 SDCTR client->server encryption
2018-05-23 22:44:02 Initialised HMAC-SHA-256 client->server MAC algorithm
2018-05-23 22:44:02 Initialised AES-256 SDCTR server->client encryption
2018-05-23 22:44:02 Initialised HMAC-SHA-256 server->client MAC algorithm
2018-05-23 22:44:02 Reading key file "<removed>"
2018-05-23 22:44:02 Pageant is running. Requesting keys.
2018-05-23 22:44:02 Pageant has 1 SSH-2 keys
2018-05-23 22:44:02 Configured key file not in Pageant
2018-05-23 22:44:02 Offered public key
2018-05-23 22:44:02 Offer of public key accepted
2018-05-23 22:44:02 Sent public key signature
2018-05-23 22:44:02 Access granted
2018-05-23 22:44:02 Opening session as main channel
2018-05-23 22:44:03 Opened main channel
2018-05-23 22:44:03 Allocated pty (ospeed 38400bps, ispeed 38400bps)
2018-05-23 22:44:03 Started a shell/command

Where o.o.o.o in line 1 represents the public IP of the EC2 instance.

Any idea why the connection is ::1 from WinSCP and not the proper IP address?

When I hold down Ctrl+Shift while clicking on Open in PuTTY this is the content of the clipboard:

"C:Program FilesPuTTYputty.exe" -load aws-ubuntu

aws-ubuntu being the name of a configuration/site in WinSCP.

Понравилась статья? Поделить с друзьями:
  • Winsock error 10060 exchange 2013
  • Winsock error 10054 mdaemon
  • Winscp file transfer error
  • Winsock error 10054 connection was reset by the other side
  • Winrs error клиенту winrm не удается обработать запрос