Is there a way to make rclone mount ignore unix file modes?

What is the problem you are having with rclone?

I use rclone mount to mount a Linux ssh drive where various git projects are checked out. The problem I'm having is that every time I edit and save a file on the mounted drive, the file mode bits get changed from 0744 to 0644.
I've searched and read so much documentation, but I still can't find a working solution to make rclone leave the file mode bits alone when editting existing files. Is there a way to do achieve this?

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

rclone v1.66.0
- os/version: Microsoft Windows 11 Pro 23H2 (64 bit)
- os/kernel: 10.0.22631.3880 (x86_64)
- os/type: windows
- os/arch: amd64
- go/version: go1.22.1
- go/linking: static
- go/tags: cmount

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

Debian 12 Linux SFTP / SSH.

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

rclone command in batch file:

set ALIAS=projects
set DRIVE_LETTER=o
rclone mount %ALIAS%:/home/%USERNAME%/ %DRIVE_LETTER%: --network-mode -v --vfs-cache-mode writes --vfs-write-back 2s --dir-cache-time 1m15s --sftp-skip-links --metadata --volname \\%ALIAS%\home


#### Please run 'rclone config redacted' and share the full output. If you get command not found, please make sure to update rclone.
<!--  You should use 3 backticks to begin and end your paste to make it readable.   -->

[projects]
type = sftp
host = XXX
user = XXX
port = 2220
disable_hashcheck = true
shell_type = unix




#### A log from the command that you were trying to run with the `-vv` flag  
<!-- You should use 3 backticks to begin and end your paste to make it readable.  Or use a service such as https://pastebin.com or https://gist.github.com/   -->

2024/07/29 14:08:10 DEBUG : rclone: Version "v1.66.0" starting with parameters ["rclone" "mount" "projects:/home/redacted/" "o:" "--network-mode" "-vv" "--vfs-cache-mode" "writes" "--vfs-write-back" "2s" "--dir-cache-time" "1m15s" "--sftp-skip-links" "--metadata" "--volname" "\\projects\home"]
2024/07/29 14:08:10 DEBUG : Creating backend with remote "projects:/home/redacted/"
2024/07/29 14:08:10 DEBUG : Using config file from "C:\Users\redacted\AppData\Roaming\rclone\rclone.conf"
2024/07/29 14:08:10 DEBUG : projects: detected overridden config - adding "{HK82T}" suffix to name
2024/07/29 14:08:11 DEBUG : sftp://redacted@XXX:2220//home/redacted/: New connection 127.0.0.1:52277->XXX:2220 to "SSH-2.0-OpenSSH_9.2p1 Debian-2+deb12u2"
2024/07/29 14:08:11 DEBUG : sftp://redacted@XXX:2220//home/redacted/: Shell type "unix" from config
2024/07/29 14:08:11 DEBUG : sftp://redacted@XXX:2220//home/redacted/: Using root directory "/home/redacted/"
2024/07/29 14:08:11 DEBUG : fs cache: renaming cache item "projects:/home/redacted/" to be canonical "projects{HK82T}:/home/redacted/"
2024/07/29 14:08:11 INFO : sftp://redacted@XXX:2220//home/redacted/: poll-interval is not supported by this remote
2024/07/29 14:08:11 DEBUG : vfs cache: root is "C:\Users\redacted\AppData\Local\rclone"
2024/07/29 14:08:11 DEBUG : vfs cache: data root is "\\?\C:\Users\redacted\AppData\Local\rclone\vfs\projects{HK82T}\home\redacted"
2024/07/29 14:08:11 DEBUG : vfs cache: metadata root is "\\?\C:\Users\redacted\AppData\Local\rclone\vfsMeta\projects{HK82T}\home\redacted"
2024/07/29 14:08:11 DEBUG : Creating backend with remote "C:/Users/redacted/AppData/Local/rclone/vfs/projects{HK82T}//home/redacted/"
2024/07/29 14:08:11 DEBUG : fs cache: renaming cache item "C:/Users/redacted/AppData/Local/rclone/vfs/projects{HK82T}//home/redacted/" to be canonical "//?/C:/Users/redacted/AppData/Local/rclone/vfs/projects{HK82T}/home/redacted"
2024/07/29 14:08:11 DEBUG : Creating backend with remote "C:/Users/redacted/AppData/Local/rclone/vfsMeta/projects{HK82T}//home/redacted/"
2024/07/29 14:08:11 DEBUG : fs cache: renaming cache item "C:/Users/redacted/AppData/Local/rclone/vfsMeta/projects{HK82T}//home/redacted/" to be canonical "//?/C:/Users/redacted/AppData/Local/rclone/vfsMeta/projects{HK82T}/home/redacted"
2024/07/29 14:08:11 DEBUG : removing 1 level 4 directories
2024/07/29 14:08:11 INFO : work/projectX/bin/cron: Removing directory
2024/07/29 14:08:11 DEBUG : removing 1 level 3 directories
2024/07/29 14:08:11 INFO : work/projectX: Removing directory
2024/07/29 14:08:11 DEBUG : removing 1 level 1 directories
2024/07/29 14:08:11 INFO : work: Removing directory
2024/07/29 14:08:11 DEBUG : removing 1 level 4 directories
2024/07/29 14:08:11 INFO : work/projectX/bin/cron: Removing directory
2024/07/29 14:08:11 DEBUG : removing 1 level 3 directories
2024/07/29 14:08:11 INFO : work/projectX/bin: Removing directory
2024/07/29 14:08:11 DEBUG : removing 1 level 2 directories
2024/07/29 14:08:11 INFO : work/projectX: Removing directory
2024/07/29 14:08:11 DEBUG : removing 1 level 1 directories
2024/07/29 14:08:11 INFO : work: Removing directory
2024/07/29 14:08:11 DEBUG : Network mode mounting is enabled
2024/07/29 14:08:11 DEBUG : Mounting on "o:" ("\projects\home")
2024/07/29 14:08:11 DEBUG : sftp://redacted@XXX:2220//home/redacted/: Mounting with options: ["-o" "attr_timeout=1" "-o" "uid=-1" "-o" "gid=-1" "--FileSystemName=rclone" "--VolumePrefix=\projects\home"]
2024/07/29 14:08:11 INFO : vfs cache: cleaned: objects 0 (was 0) in use 0, to upload 0, uploading 0, total size 0 (was 0)

snipped a lot out because it doesn't fit

2024/07/29 14:08:50 DEBUG : /work/projectX/bin/cron/script.php: Getattr: fh=0xFFFFFFFFFFFFFFFF
2024/07/29 14:08:50 DEBUG : /work/projectX/bin/cron/script.php: >Getattr: errc=0
2024/07/29 14:08:50 DEBUG : /work/projectX/bin/cron/script.php: Getattr: fh=0xFFFFFFFFFFFFFFFF
2024/07/29 14:08:50 DEBUG : /work/projectX/bin/cron/script.php: >Getattr: errc=0
2024/07/29 14:08:50 DEBUG : /work/projectX/bin/cron/script.php: OpenEx: flags=0x0
2024/07/29 14:08:50 DEBUG : /work/projectX/bin/cron/script.php: OpenFile: flags=O_RDONLY, perm=-rwxrwxrwx
2024/07/29 14:08:50 DEBUG : work/projectX/bin/cron/script.php: Open: flags=O_RDONLY
2024/07/29 14:08:50 DEBUG : work/projectX/bin/cron/script.php: >Open: fd=work/projectX/bin/cron/script.php (r), err=
2024/07/29 14:08:50 DEBUG : /work/projectX/bin/cron/script.php: >OpenFile: fd=work/projectX/bin/cron/script.php (r), err=
2024/07/29 14:08:50 DEBUG : /work/projectX/bin/cron/script.php: >OpenEx: errc=0, fh=0x0

snipped more

2024/07/29 14:08:52 DEBUG : work/projectX/bin/cron/script.php: >Open: fd=work/projectX/bin/cron/script.php (rw), err=
2024/07/29 14:08:52 DEBUG : /work/projectX/bin/cron/script.php: >OpenFile: fd=work/projectX/bin/cron/script.php (rw), err=
2024/07/29 14:08:52 DEBUG : /work/projectX/bin/cron/script.php: >OpenEx: errc=0, fh=0x1
2024/07/29 14:08:52 DEBUG : /work/projectX/bin/cron/script.php: Getattr: fh=0x1
2024/07/29 14:08:52 DEBUG : /work/projectX/bin/cron/script.php: >Getattr: errc=0
2024/07/29 14:08:52 DEBUG : /work/projectX/bin/cron/script.php: Flush: fh=0x1
2024/07/29 14:08:52 DEBUG : work/projectX/bin/cron/script.php(0xc00080ccc0): RWFileHandle.Flush
2024/07/29 14:08:52 DEBUG : /work/projectX/bin/cron/script.php: >Flush: errc=0
2024/07/29 14:08:52 DEBUG : /work/projectX/bin/cron/script.php: Release: fh=0x1
2024/07/29 14:08:52 DEBUG : work/projectX/bin/cron/script.php(0xc00080ccc0): RWFileHandle.Release
2024/07/29 14:08:52 DEBUG : work/projectX/bin/cron/script.php(0xc00080ccc0): close:
2024/07/29 14:08:52 DEBUG : work/projectX/bin/cron/script.php(0xc00080ccc0): >close: err=
2024/07/29 14:08:52 DEBUG : /work/projectX/bin/cron/script.php: >Release: errc=0
2024/07/29 14:08:52 DEBUG : /work/projectX/bin/cron/script.php: Getattr: fh=0x0
2024/07/29 14:08:52 DEBUG : /work/projectX/bin/cron/script.php: >Getattr: errc=0
2024/07/29 14:08:52 DEBUG : /work/projectX/bin/cron/script.php: Write: ofst=0, fh=0x0
2024/07/29 14:08:52 DEBUG : work/projectX/bin/cron/script.php(0xc00080c9c0): _writeAt: size=4974, off=0
2024/07/29 14:08:52 DEBUG : work/projectX/bin/cron/script.php(0xc00080c9c0): >_writeAt: n=4974, err=
2024/07/29 14:08:52 DEBUG : /work/projectX/bin/cron/script.php: >Write: n=4974
2024/07/29 14:08:52 DEBUG : /work/projectX/bin/cron/script.php: Fsync: datasync=false, fh=0x0
2024/07/29 14:08:52 DEBUG : /work/projectX/bin/cron/script.php: >Fsync: errc=0
2024/07/29 14:08:52 DEBUG : /work/projectX/bin/cron/script.php: Getattr: fh=0x0
2024/07/29 14:08:52 DEBUG : /work/projectX/bin/cron/script.php: >Getattr: errc=0
2024/07/29 14:08:52 DEBUG : /work/projectX/bin/cron/script.php: Flush: fh=0x0
2024/07/29 14:08:52 DEBUG : work/projectX/bin/cron/script.php(0xc00080c9c0): RWFileHandle.Flush
2024/07/29 14:08:52 DEBUG : /work/projectX/bin/cron/script.php: Getattr: fh=0xFFFFFFFFFFFFFFFF
2024/07/29 14:08:52 DEBUG : /work/projectX/bin/cron/script.php: >Flush: errc=0
2024/07/29 14:08:52 DEBUG : /work/projectX/bin/cron/script.php: Release: fh=0x0
2024/07/29 14:08:52 DEBUG : work/projectX/bin/cron/script.php(0xc00080c9c0): RWFileHandle.Release
2024/07/29 14:08:52 DEBUG : work/projectX/bin/cron/script.php(0xc00080c9c0): close:
2024/07/29 14:08:52 DEBUG : /work/projectX/bin/cron/script.php: >Getattr: errc=0
2024/07/29 14:08:52 DEBUG : vfs cache: looking for range={Pos:0 Size:4974} in [{Pos:0 Size:4974}] - present true
2024/07/29 14:08:52 DEBUG : /work/projectX/bin/cron/script.php: Getattr: fh=0xFFFFFFFFFFFFFFFF
2024/07/29 14:08:52 DEBUG : work/projectX/bin/cron/script.php: vfs cache: setting modification time to 2024-07-29 14:08:52.6505951 +0200 CEST m=+41.843428201
2024/07/29 14:08:52 INFO : work/projectX/bin/cron/script.php: vfs cache: queuing for upload in 2s

welcome to the forum,

have you tried --file-perms

No because that will set the same permissions to every file I edit from what I've read, instead of ignoring file permissions.
Actually, I think the problem is that OpenSSH SFTP uses a default file mode when files are re-uploaded and that the client must issue the chmod command to reset the file mode to the original state, and I suspect that rclone (or the underlying VFS) is not doing that.

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