rclone/rclone

Add Support for Encoding to sftp Connections

Open

#8,574 建立於 2025年5月27日

在 GitHub 查看
 (4 留言) (0 反應) (0 負責人)Go (57,185 star) (5,090 fork)batch import
Remote: SFTPencodingenhancementgood first issuehelp wanted

描述

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 chars that Windows does not support such as : in "test:test.txt", same for folders.

I should be able to use --sftp-encoding like this, but sftp.go does not have support for it:

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

It should also be possible to set those encoding in a conf file.

Here is my original post containing versions and logs: https://forum.rclone.org/t/rclone-from-macos-linux-to-windows-via-sftp-using-bitvise-ssh-server/51323

Here are the logs for rclone v1.69.3

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

貢獻者指南