From 80a32e631f6f5cbc4dc6f9687be7f2beaf0b804b Mon Sep 17 00:00:00 2001 From: michael Date: Wed, 8 Jul 2026 19:08:02 +0200 Subject: [PATCH] fix: SFTP sync failures from restricted-shell md5sum and checksum fallback On SFTP remotes with restricted shells (e.g. Synology NAS), rclone's --checksum option makes it call md5sum/sha1sum over SSH to verify transfers. Restricted shells often can't see paths that are only exposed via SFTP, so every transfer failed with "corrupted on transfer: md5 hashes differ" / "failed to run md5sum: No such file or directory". Disable the remote hash commands for SFTP remotes (--sftp-md5sum-command/--sftp-sha1sum-command none) so rclone doesn't attempt them. Disabling both, however, leaves rclone with no common hash type when --checksum is still requested; it silently falls back to a size-only comparison and ignores modification time, so a changed file that keeps the same size never gets re-synced. Skip --checksum entirely for SFTP remotes so rclone falls back to its default size+modtime comparison instead. Verified against a live Synology SFTP remote and a physical Pixel 7a (GrapheneOS): transfers that previously failed with the md5sum error now succeed, and a same-size/changed-content file is correctly detected via modtime and re-transferred instead of being silently skipped. Co-Authored-By: Claude Sonnet 4.6 --- .../java/ca/pkay/rcloneexplorer/Rclone.java | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/ca/pkay/rcloneexplorer/Rclone.java b/app/src/main/java/ca/pkay/rcloneexplorer/Rclone.java index b21b771b5..458905f71 100644 --- a/app/src/main/java/ca/pkay/rcloneexplorer/Rclone.java +++ b/app/src/main/java/ca/pkay/rcloneexplorer/Rclone.java @@ -691,9 +691,24 @@ public Process sync(RemoteItem remoteItem, String localPath, String remotePath, ArrayList defaultParameter = new ArrayList<>(Arrays.asList("--transfers", "1", "--stats=1s", "--stats-log-level", "NOTICE", "--use-json-log")); ArrayList directionParameter = new ArrayList<>(); - if(useMD5Sum){ + boolean isSftpRemote = remoteItem.isRemoteType(RemoteItem.SFTP); + if(useMD5Sum && !isSftpRemote){ defaultParameter.add("--checksum"); } + if(isSftpRemote){ + // Many SFTP servers (e.g. Synology restricted shells) can't run md5sum/sha1sum + // over SSH even though the files are reachable via SFTP. Disabling the remote + // hash commands avoids "corrupted on transfer: hashes differ" failures, but it + // also means no common hash type is left to compare with --checksum. If both + // were combined, rclone silently falls back to a size-only comparison and + // ignores modification time, so changed files of the same size never get + // re-synced. Skip --checksum here and let rclone use its default size+modtime + // comparison instead. + defaultParameter.add("--sftp-md5sum-command"); + defaultParameter.add("none"); + defaultParameter.add("--sftp-sha1sum-command"); + defaultParameter.add("none"); + } if(deleteExcluded){ defaultParameter.add("--delete-excluded"); }