FTP: rclone transfers some files, then fails to send anything else

What is the problem you are having with rclone?

Rclone transfers 10-30 files, then fails for some, with message:

wsarecv: An attempt was made to access a socket in a way forbidden by its access permissions.
and after that a bunch of
wsasend: An existing connection was forcibly closed by the remote host.

Then sometimes it gets up and manages to transfer some more files, before failing again (the scheme repeats a few times). Ultimately it fails completely, and outputs the forcibly closed errors for all remaining files.

If I kill rclone and start it again immediately, it works fine for some files, and then breaks again.
If I transfer the same files with FileZilla, I can see some ECONNABORTED errors in the log, but it immediately reconnects and keeps transferring.
Rclone does not seem to reconnect. Perhaps that would help if it did? Is there a way to make it reconnect on socket errors?

A side-rant, and a question: For the past year, I have been trying to set up a personal backup solution using rclone and some FTP servers, but every time I fix one error, another pops up. This report is a result of just a try of another FTP server, since my default server had other kinds of problems (more likely to be server-side issues). Since FTP seems to be highly problematic, and rclone supports many other cloud services, could you recommend a cloud service for backups (I need about 1TB of space) that would be not very expensive, and at the same time work with rclone without issues? I am already tired of constant problems with this. I would like to set it up once and forget. I don't want a backup solution with a proprietary app (like idrive), because I need some specific features they do not have.

Run the command 'rclone version' and share the full output of the command.

rclone v1.63.0
- os/version: Microsoft Windows 10 Home 22H2 (64 bit)
- os/kernel: 10.0.19045.3086 (x86_64)
- os/type: windows
- os/arch: amd64
- go/version: go1.20.5
- go/linking: static
- go/tags: cmount

Which cloud storage system are you using? (eg Google Drive)

FTP (Pure-FTPd)

The command you were trying to run (eg rclone copy /tmp remote:tmp)


C:\PProg\Dysk\rclone\rclone.exe copy E:\Zdjecia enklawa_crypt:zdjecia/current `
  --backup-dir="enklawa_crypt:zdjecia/old_$dt" `
  --config="$PSScriptRoot\rclone.lapasus.kaziqnet.config" `
  --password-command="$password_cmd" `
  --filter-from="$PSScriptRoot\rclone_filter.txt" `
  --ftp-concurrency=1 `
  --transfers=1 `
  --bwlimit=5M:20M `
  --retries-sleep=10s `
  --retries=1 `
  --low-level-retries=5 `
  -vv `
  2>&1 | % ToString | Tee-Object -FilePath D:\BackupScript\rclone\Last-run.txt 

The rclone config contents with secrets removed.

type = ftp
host = cl12.netmark.pl
user = (removed)
port = 21
pass = (removed)
explicit_tls = true
disable_mfmt = false
disable_tls13 = true
encoding = Slash,BackSlash,Del,Ctl,RightSpace,Dot,SquareBracket
concurrency = 3
tls_cache_size = 64

type = crypt
remote = enklawa:Lapasus
directory_name_encryption = false
password = (removed)

A log from the command with the -vv flag

too large to paste, sharing with Dropbox

Interesting option is to get office 365 family - it comes with 6x 1TB onedrive accounts (they can be combined if needed using rclone union). You can get on Amazon 27 months license for £136 - it is £5 per month for 6TB where e.g. Google Drive is £8 per month for 2TB. I use onedrive quite a lot (also for backups) and it works perfectly with rclone. And as a perk you have 6 licenses of MS Office - with every user able to install it on 5 devices.

1 Like

Rclone will retry errors however neither wsasend nor wsarecv are in the list of errors that it normally retries as they indicate more permanent problems. Maybe wsasend should be.

However those errors wsasend: An existing connection was forcibly closed by the remote host. either come from the remote host or a firewall between you and the remote host.

This makes me think that a local firewall might be interfering: wsarecv: An attempt was made to access a socket in a way forbidden by its access permissions.

Do you have a local firewall? Can you turn it off and try the transfer?

PS FTP is a very old protocol and it doesn't play nicely with a lot of firewalls.

1 Like

Thanks, ncw, helpful as always :slight_smile:
It is indeed a firewall. The Windows firewall to be specific. When I disable it, rclone works fine. That is strange, because I have added rclone.exe to the allowed programs earlier, and it didn't help. I have allowed all protocols and networks for it, but the problems still happen. they disappear the moment I disable the firewall completely, even if rclone is in the middle of the 'copy' process.

I also tried to add rclone to both outbound and nbound rules. No difference.
Also tried enabling all TCP connections through ports 20-21 and 5001-5008, as suggested on some page. No difference.

Does anyone know how to add rclone to the Windows firewall, so that it won't interfere? Now it seems to kick in at random, which is horrible behaviour.

Also, @kapitainsky , thanks for the Office idea, it's worth considering.

In the past and only on windows I had issues with ftp - what always solved the problem was to move away from from port 21 - something above 1024. Windows firewall is well... what it is. For some reason it insist to keep close eye on system ports regardless of user IP rules. Maybe we did not know windows enough to change it.

Forget ftp - I am puzzled why people still use it trying to secure it in more or less creative ways when sftp is everywhere for decades.

1 Like

I believe adding rclone.exe is the correct thing to do. It needs to be the binary you are actually using though I think so that would be something to double check.

Not a windows expert though - sorry!

Actually, I forgot about SFTP :slight_smile:
But tested it on the test server, and it works like a charm :smiley:
I couldn't use SFTP earlier, because it had problems, and now it doesn't work at all on my base server. But I will ask the owner to enable it, if possible (it's running docker, and he says it's tricky).

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.