Rclone from MacOS/Linux to Windows via sftp using Bitvise SSH Server

What is the problem you are having with rclone?

I have a Windows server that runs Bitvise SSH Server which I want to sync files to from MacOS and Linux. I'm using sftp which probably expects it to be Linux. Sync works for most of the files, but fails trying to sync files that contains a col like "test:test.txt", same for folders.

I tried setting shell_type = cmd in the config, but it didn't help. I also added --local-encoding "Slash,BackSlash,Ctl,Dot,RightSpace,RightPeriod,InvalidUtf8" that I found in the smb driver (minus Win and Zero which were rejected)

I need a way to tell the sftp driver that the remove fs is Windows and to do the char escaping/substitutions accordingly. Thanks!

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

rclone v1.69.3
- os/version: debian 11.11 (64 bit)
- os/kernel: 5.10.0-35-amd64 (x86_64)
- os/type: linux
- os/arch: amd64
- go/version: go1.24.3
- go/linking: static
- go/tags: none

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

sftp

Note: runs on Windows Server 2019 via Bitvise SSH Server:

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

rclone sync backup/ dest:M/Documents/backups/test 

rclone sync backup/ dest:M/Documents/backups/test --local-encoding "Slash,BackSlash,Ctl,Dot,RightSpace,RightPeriod,InvalidUtf8"

Please run 'rclone config redacted' and share the full output. If you get command not found, please make sure to update rclone.

[dest]
type = sftp
host = XXX
user = XXX
port = 443
pass = XXX
md5sum_command = none
sha1sum_command = none
shell_type = cmd

I set shell_type = cmd because Bitvise SSH shell is Windows cmd.exe

A log from the command that you were trying to run with the -vv flag

2025/05/25 18:33:45 DEBUG : Creating backend with remote "backup/"
2025/05/25 18:33:45 DEBUG : Using config file from "/home/user/.config/rclone/rclone.conf"
2025/05/25 18:33:45 DEBUG : fs cache: renaming cache item "backup/" to be canonical "/home/user/backup"
2025/05/25 18:33:45 DEBUG : Creating backend with remote "dest:M/Documents/backups/test"
2025/05/25 18:33:45 DEBUG : sftp://user@dest:443/M/Documents/backups/test: New connection 192.168.0.18:59518-><redacted>:443 to "SSH-2.0-9.99 FlowSsh: Bitvise SSH Server (WinSSHD) : free only for personal non-commercial use"
2025/05/25 18:33:45 DEBUG : sftp://user@dest:443/M/Documents/backups/test: Shell type "cmd" from config
2025/05/25 18:33:45 DEBUG : sftp://user@dest:443/M/Documents/backups/test: Relative path resolved to "/M/Documents/backups/test"
2025/05/25 18:33:45 DEBUG : sftp://user@dest:443/M/Documents/backups/test: Using root directory "/M/Documents/backups/test"
2025/05/25 18:33:45 DEBUG : test:test.txt: Need to transfer - File not found at Destination
2025/05/25 18:33:45 DEBUG : test.txt: Size and modification time the same (differ by -780.240273ms, within tolerance 1s)
2025/05/25 18:33:45 DEBUG : test.txt: Unchanged skipping
2025/05/25 18:33:45 DEBUG : sftp://user@dest:443/M/Documents/backups/test: Waiting for checks to finish
2025/05/25 18:33:45 DEBUG : sftp://user@dest:443/M/Documents/backups/test: Waiting for transfers to finish
2025/05/25 18:33:45 ERROR : test:test.txt: Failed to copy: Update Create failed: file does not exist
2025/05/25 18:33:45 ERROR : sftp://user@dest:443/M/Documents/backups/test: not deleting files as there were IO errors
2025/05/25 18:33:45 ERROR : sftp://user@dest:443/M/Documents/backups/test: not deleting directories as there were IO errors
2025/05/25 18:33:45 ERROR : Attempt 1/3 failed with 1 errors and: Update Create failed: file does not exist
2025/05/25 18:33:45 DEBUG : test:test.txt: Need to transfer - File not found at Destination
2025/05/25 18:33:45 DEBUG : sftp://user@dest:443/M/Documents/backups/test: Waiting for checks to finish
2025/05/25 18:33:45 DEBUG : test.txt: Size and modification time the same (differ by -780.240273ms, within tolerance 1s)
2025/05/25 18:33:45 DEBUG : test.txt: Unchanged skipping
2025/05/25 18:33:45 DEBUG : sftp://user@dest:443/M/Documents/backups/test: Waiting for transfers to finish
2025/05/25 18:33:45 ERROR : test:test.txt: Failed to copy: Update Create failed: file does not exist
2025/05/25 18:33:45 ERROR : sftp://user@dest:443/M/Documents/backups/test: not deleting files as there were IO errors
2025/05/25 18:33:45 ERROR : sftp://user@dest:443/M/Documents/backups/test: not deleting directories as there were IO errors
2025/05/25 18:33:45 ERROR : Attempt 2/3 failed with 1 errors and: Update Create failed: file does not exist
2025/05/25 18:33:45 DEBUG : test:test.txt: Need to transfer - File not found at Destination
2025/05/25 18:33:45 DEBUG : test.txt: Size and modification time the same (differ by -780.240273ms, within tolerance 1s)
2025/05/25 18:33:45 DEBUG : test.txt: Unchanged skipping
2025/05/25 18:33:45 DEBUG : sftp://user@dest:443/M/Documents/backups/test: Waiting for checks to finish
2025/05/25 18:33:45 DEBUG : sftp://user@dest:443/M/Documents/backups/test: Waiting for transfers to finish
2025/05/25 18:33:45 ERROR : test:test.txt: Failed to copy: Update Create failed: file does not exist
2025/05/25 18:33:45 ERROR : sftp://user@dest:443/M/Documents/backups/test: not deleting files as there were IO errors
2025/05/25 18:33:45 ERROR : sftp://user@dest:443/M/Documents/backups/test: not deleting directories as there were IO errors
2025/05/25 18:33:45 ERROR : Attempt 3/3 failed with 1 errors and: Update Create failed: file does not exist
2025/05/25 18:33:45 INFO  :
Transferred:              0 B / 0 B, -, 0 B/s, ETA -
Errors:                 1 (retrying may help)
Checks:                 3 / 3, 100%
Elapsed time:         0.0s

2025/05/25 18:33:45 DEBUG : 14 go routines active
2025/05/25 18:33:45 DEBUG : sftp://user@dest:443/M/Documents/backups/test: Closing 1 unused connections
2025/05/25 18:33:45 NOTICE: Failed to sync: Update Create failed: file does not exist

welcome to the forum,

i used that for many years. great product.
i still use bitvise client, as it uses winfsp to mount the sftp, same as rclone.

maybe add Colon

thx @asdffdsa

I found that Win is an alias for Colon,Question,DoubleQuote,Asterisk,LtGt,Pipe so I added all of that:

  --local-encoding "Slash,BackSlash,Ctl,Dot,RightSpace,RightPeriod,InvalidUtf8,Colon,Question,DoubleQuote,Asterisk,LtGt,Pipe"

I also added it to the conf file, but the result is the same. tried --ftp-encoding too.

maybe @kapitainsky?

I have had a look at the source code and I think that the issue is that there is no sftp-encoding option implemented at all. Using ftp-encoding has no effect for sftp backend. No idea why this omission - maybe there was some reason?

@fenneclabs I suggest you create github issue/feature request.

I see, that's why I could not find encodings in sftp source! I'll spend some time poking at the source and open a PR if I make some progress. If not I'll create an issue.

Thx @kapitainsky

@kapitainsky I tried to fix the issue, but I figured that if miss just one encoding, it could do more harm than good.

I opened this FR instead:

1 Like