Rclone B2 as a service with SYSTEM user cannot edit and save to the same file. or overwrite file

What is the problem you are having with rclone?

If I run a batch file with:
C:\rclone.exe mount b2:coredatarecovery Y: --network-mode --vfs-cache-mode writes --config=C:\Users\cored\AppData\Roaming\rclone\rclone.conf --no-console

I can edit the files and save them.
with NSSM setting a service with C:\rclone\rclone.exe
with the attributes set:
mount cb2: Y: --network-mode --vfs-cache-mode writes --config=C:\Users\cored\AppData\Roaming\rclone\rclone.conf

Drive mounts fine but I cannot edit or overwrite the file. Simple test is to create a bucket
Map it as drive Y and create a new text file, type text, save. it works to save close the file and open it
add a line, type test. save, now instead of saving it opens a save as window and you can't overwrite the file. You also cannot save the file as a new text document.

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

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

B2 Backblaze, option 6 but it also happens with the encryption on.
winfsp-2.0.23075 but I've tried several different versions and computers

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

notepad Y:\test.txt

The rclone config contents with secrets removed.

\\\
[b2]
type = b2
account = 
key = 

[cb2]
type = crypt
remote = b2:corecrypt
password = 
password2 = 
[goog]
type = drive
client_id = 
client_secret = 
scope = drive
token = {}
team_drive = 

[db]
type = dropbox
token = {}
\\\

A log from the command with the -vv flag

C:\Users\cored>rclone mount b2:coredatarecovery z: --network-mode --vfs-cache-mode writes --config=C:\Users\cored\AppData\Roaming\rclone\rclone.conf -vv
2023/05/03 21:46:27 DEBUG : rclone: Version "v1.57.0" starting with parameters ["rclone" "mount" "b2:coredatarecovery" "z:" "--network-mode" "--vfs-cache-mode" "writes" "--config=C:\\Users\\cored\\AppData\\Roaming\\rclone\\rclone.conf" "-vv"]
2023/05/03 21:46:27 DEBUG : Creating backend with remote "b2:coredatarecovery"
2023/05/03 21:46:27 DEBUG : Using config file from "C:\\Users\\cored\\AppData\\Roaming\\rclone\\rclone.conf"
2023/05/03 21:46:27 INFO  : B2 bucket coredatarecovery: poll-interval is not supported by this remote
2023/05/03 21:46:27 DEBUG : vfs cache: root is "C:\\Users\\cored\\AppData\\Local\\rclone"
2023/05/03 21:46:27 DEBUG : vfs cache: data root is "\\\\?\\C:\\Users\\cored\\AppData\\Local\\rclone\\vfs\\b2\\coredatarecovery"
2023/05/03 21:46:27 DEBUG : vfs cache: metadata root is "\\\\?\\C:\\Users\\cored\\AppData\\Local\\rclone\\vfsMeta\\b2\\coredatarecovery"
2023/05/03 21:46:27 DEBUG : Creating backend with remote "C:/Users/cored/AppData/Local/rclone/vfs/b2/coredatarecovery"
2023/05/03 21:46:27 DEBUG : fs cache: renaming cache item "C:/Users/cored/AppData/Local/rclone/vfs/b2/coredatarecovery" to be canonical "//?/C:/Users/cored/AppData/Local/rclone/vfs/b2/coredatarecovery"
2023/05/03 21:46:27 DEBUG : Creating backend with remote "C:/Users/cored/AppData/Local/rclone/vfsMeta/b2/coredatarecovery"
2023/05/03 21:46:27 DEBUG : fs cache: renaming cache item "C:/Users/cored/AppData/Local/rclone/vfsMeta/b2/coredatarecovery" to be canonical "//?/C:/Users/cored/AppData/Local/rclone/vfsMeta/b2/coredatarecovery"
2023/05/03 21:46:27 DEBUG : Network mode mounting is enabled
2023/05/03 21:46:27 DEBUG : Mounting on "z:" ("\\server\\b2 coredatarecovery")
2023/05/03 21:46:27 DEBUG : B2 bucket coredatarecovery: Mounting with options: ["-o" "attr_timeout=1" "-o" "uid=-1" "-o" "gid=-1" "--FileSystemName=rclone" "--VolumePrefix=\\server\\b2 coredatarecovery"]
2023/05/03 21:46:27 INFO  : 2020fall basis.txt: vfs cache: removed cache file as Removing old cache file not in use
2023/05/03 21:46:27 DEBUG : 2020fall basis.txt: vfs cache: removed metadata from cache as Removing old cache file not in use
2023/05/03 21:46:27 INFO  : vfs cache RemoveNotInUse (maxAge=3600000000000, emptyOnly=false): item 2020fall basis.txt was removed, freed 478 bytes
2023/05/03 21:46:27 INFO  : vfs cache: cleaned: objects 0 (was 1) in use 0, to upload 0, uploading 0, total size 0 (was 478)
2023/05/03 21:46:27 DEBUG : B2 bucket coredatarecovery: Init:
2023/05/03 21:46:27 DEBUG : B2 bucket coredatarecovery: >Init:
2023/05/03 21:46:27 DEBUG : /: Statfs:
2023/05/03 21:46:27 DEBUG : /: >Statfs: stat={Bsize:4096 Frsize:4096 Blocks:274877906944 Bfree:274877906944 Bavail:274877906944 Files:1000000000 Ffree:1000000000 Favail:0 Fsid:0 Flag:0 Namemax:255}, errc=0
2023/05/03 21:46:27 DEBUG : /: Getattr: fh=0xFFFFFFFFFFFFFFFF
2023/05/03 21:46:27 DEBUG : /: >Getattr: errc=0
2023/05/03 21:46:27 DEBUG : /: Readlink:
2023/05/03 21:46:27 DEBUG : /: >Readlink: linkPath="", errc=-40
2023/05/03 21:46:27 DEBUG : /: Getattr: fh=0xFFFFFFFFFFFFFFFF
2023/05/03 21:46:27 DEBUG : /: >Getattr: errc=0
2023/05/03 21:46:27 DEBUG : /: Getattr: fh=0xFFFFFFFFFFFFFFFF
2023/05/03 21:46:27 DEBUG : /: >Getattr: errc=0
2023/05/03 21:46:27 DEBUG : /: Opendir:
The service rclone has been started.
2023/05/03 21:46:27 DEBUG : /: OpenFile: flags=O_RDONLY, perm=-rwxrwxrwx
2023/05/03 21:46:27 DEBUG : /: >OpenFile: fd=/ (r), err=<nil>
2023/05/03 21:46:27 DEBUG : /: >Opendir: errc=0, fh=0x0
2023/05/03 21:46:27 DEBUG : /: Getattr: fh=0xFFFFFFFFFFFFFFFF
2023/05/03 21:46:27 DEBUG : /: Releasedir: fh=0x0
2023/05/03 21:46:27 DEBUG : /: >Releasedir: errc=0
2023/05/03 21:46:27 DEBUG : /: >Getattr: errc=0
2023/05/03 21:46:27 DEBUG : /: Getattr: fh=0xFFFFFFFFFFFFFFFF
2023/05/03 21:46:27 DEBUG : /: >Getattr: errc=0
2023/05/03 21:46:27 DEBUG : /: Opendir:
2023/05/03 21:46:27 DEBUG : /: OpenFile: flags=O_RDONLY, perm=-rwxrwxrwx
2023/05/03 21:46:27 DEBUG : /: >OpenFile: fd=/ (r), err=<nil>
2023/05/03 21:46:27 DEBUG : /: >Opendir: errc=0, fh=0x0
2023/05/03 21:46:27 DEBUG : /: Getattr: fh=0xFFFFFFFFFFFFFFFF
2023/05/03 21:46:27 DEBUG : /: >Getattr: errc=0
2023/05/03 21:46:27 DEBUG : /: Releasedir: fh=0x0
2023/05/03 21:46:27 DEBUG : /: >Releasedir: errc=0
2023/05/03 21:46:27 DEBUG : /: Getattr: fh=0xFFFFFFFFFFFFFFFF
2023/05/03 21:46:27 DEBUG : /: >Getattr: errc=0
2023/05/03 21:46:27 DEBUG : /: Opendir:
2023/05/03 21:46:27 DEBUG : /: OpenFile: flags=O_RDONLY, perm=-rwxrwxrwx
2023/05/03 21:46:27 DEBUG : /: >OpenFile: fd=/ (r), err=<nil>
2023/05/03 21:46:27 DEBUG : /: >Opendir: errc=0, fh=0x0
2023/05/03 21:46:27 DEBUG : /: Releasedir: fh=0x0
2023/05/03 21:46:27 DEBUG : /: >Releasedir: errc=0
2023/05/03 21:46:27 DEBUG : /Desktop.ini: Getattr: fh=0xFFFFFFFFFFFFFFFF
2023/05/03 21:46:28 DEBUG : /Desktop.ini: >Getattr: errc=-2
2023/05/03 21:46:28 DEBUG : /Desktop.ini: Getattr: fh=0xFFFFFFFFFFFFFFFF
2023/05/03 21:46:28 DEBUG : /Desktop.ini: >Getattr: errc=-2
2023/05/03 21:46:28 DEBUG : /AutoRun.inf: Getattr: fh=0xFFFFFFFFFFFFFFFF
2023/05/03 21:46:28 DEBUG : /AutoRun.inf: >Getattr: errc=-2
2023/05/03 21:46:29 DEBUG : /: Getattr: fh=0xFFFFFFFFFFFFFFFF
2023/05/03 21:46:29 DEBUG : /: >Getattr: errc=0
2023/05/03 21:46:29 DEBUG : /: Getattr: fh=0xFFFFFFFFFFFFFFFF
2023/05/03 21:46:29 DEBUG : /: >Getattr: errc=0
2023/05/03 21:46:29 DEBUG : /: Opendir:
2023/05/03 21:46:29 DEBUG : /: OpenFile: flags=O_RDONLY, perm=-rwxrwxrwx
2023/05/03 21:46:29 DEBUG : /: >OpenFile: fd=/ (r), err=<nil>
2023/05/03 21:46:29 DEBUG : /: >Opendir: errc=0, fh=0x0
2023/05/03 21:46:29 DEBUG : /: Releasedir: fh=0x0
2023/05/03 21:46:29 DEBUG : /: >Releasedir: errc=0
2023/05/03 21:46:29 DEBUG : /: Getattr: fh=0xFFFFFFFFFFFFFFFF
2023/05/03 21:46:29 DEBUG : /: >Getattr: errc=0
2023/05/03 21:46:29 DEBUG : /: Getattr: fh=0xFFFFFFFFFFFFFFFF
2023/05/03 21:46:29 DEBUG : /: >Getattr: errc=0
2023/05/03 21:46:29 DEBUG : /: Opendir:
2023/05/03 21:46:29 DEBUG : /: OpenFile: flags=O_RDONLY, perm=-rwxrwxrwx
2023/05/03 21:46:29 DEBUG : /: >OpenFile: fd=/ (r), err=<nil>
2023/05/03 21:46:29 DEBUG : /: >Opendir: errc=0, fh=0x0
2023/05/03 21:46:29 DEBUG : /: Releasedir: fh=0x0
2023/05/03 21:46:29 DEBUG : /: >Releasedir: errc=0
2023/05/03 21:46:29 DEBUG : /: Getattr: fh=0xFFFFFFFFFFFFFFFF
2023/05/03 21:46:29 DEBUG : /: >Getattr: errc=0
2023/05/03 21:46:29 DEBUG : /: Getattr: fh=0xFFFFFFFFFFFFFFFF
2023/05/03 21:46:29 DEBUG : /: >Getattr: errc=0
2023/05/03 21:46:29 DEBUG : /: Opendir:
2023/05/03 21:46:29 DEBUG : /: OpenFile: flags=O_RDONLY, perm=-rwxrwxrwx
2023/05/03 21:46:29 DEBUG : /: >OpenFile: fd=/ (r), err=<nil>
2023/05/03 21:46:29 DEBUG : /: >Opendir: errc=0, fh=0x0
2023/05/03 21:46:29 DEBUG : /: Releasedir: fh=0x0
2023/05/03 21:46:29 DEBUG : /: >Releasedir: errc=0
2023/05/03 21:46:29 DEBUG : /: Getattr: fh=0xFFFFFFFFFFFFFFFF
2023/05/03 21:46:29 DEBUG : /: >Getattr: errc=0
2023/05/03 21:46:29 DEBUG : /: Getattr: fh=0xFFFFFFFFFFFFFFFF
2023/05/03 21:46:29 DEBUG : /: >Getattr: errc=0
2023/05/03 21:46:29 DEBUG : /: Opendir:
2023/05/03 21:46:29 DEBUG : /: OpenFile: flags=O_RDONLY, perm=-rwxrwxrwx
2023/05/03 21:46:29 DEBUG : /: >OpenFile: fd=/ (r), err=<nil>
2023/05/03 21:46:29 DEBUG : /: >Opendir: errc=0, fh=0x0
2023/05/03 21:46:29 DEBUG : /: Releasedir: fh=0x0
2023/05/03 21:46:29 DEBUG : /: >Releasedir: errc=0
2023/05/03 21:46:29 DEBUG : /: Getattr: fh=0xFFFFFFFFFFFFFFFF
2023/05/03 21:46:29 DEBUG : /: >Getattr: errc=0
2023/05/03 21:46:29 DEBUG : /: Getattr: fh=0xFFFFFFFFFFFFFFFF
2023/05/03 21:46:29 DEBUG : /: >Getattr: errc=0
2023/05/03 21:46:29 DEBUG : /: Opendir:
2023/05/03 21:46:29 DEBUG : /: OpenFile: flags=O_RDONLY, perm=-rwxrwxrwx
2023/05/03 21:46:29 DEBUG : /: >OpenFile: fd=/ (r), err=<nil>
2023/05/03 21:46:29 DEBUG : /: >Opendir: errc=0, fh=0x0
2023/05/03 21:46:29 DEBUG : /: Releasedir: fh=0x0
2023/05/03 21:46:29 DEBUG : /: >Releasedir: errc=0
\\\
C:\rclone>rclone mount b2:coredatarecovery z: --network-mode --vfs-cache-mode writes --config=C:\Users\cored\AppData\Roaming\rclone\rclone.conf -vv
2023/05/03 22:05:51 DEBUG : rclone: Version "v1.62.2" starting with parameters ["rclone" "mount" "b2:coredatarecovery" "z:" "--network-mode" "--vfs-cache-mode" "writes" "--config=C:\\Users\\cored\\AppData\\Roaming\\rclone\\rclone.conf" "-vv"]
2023/05/03 22:05:51 DEBUG : Creating backend with remote "b2:coredatarecovery"
2023/05/03 22:05:51 DEBUG : Using config file from "C:\\Users\\cored\\AppData\\Roaming\\rclone\\rclone.conf"
2023/05/03 22:05:51 INFO  : B2 bucket coredatarecovery: poll-interval is not supported by this remote
2023/05/03 22:05:51 DEBUG : vfs cache: root is "C:\\Users\\cored\\AppData\\Local\\rclone"
2023/05/03 22:05:51 DEBUG : vfs cache: data root is "\\\\?\\C:\\Users\\cored\\AppData\\Local\\rclone\\vfs\\b2\\coredatarecovery"
2023/05/03 22:05:51 DEBUG : vfs cache: metadata root is "\\\\?\\C:\\Users\\cored\\AppData\\Local\\rclone\\vfsMeta\\b2\\coredatarecovery"
2023/05/03 22:05:51 DEBUG : Creating backend with remote "C:/Users/cored/AppData/Local/rclone/vfs/b2/coredatarecovery"
2023/05/03 22:05:51 DEBUG : fs cache: renaming cache item "C:/Users/cored/AppData/Local/rclone/vfs/b2/coredatarecovery" to be canonical "//?/C:/Users/cored/AppData/Local/rclone/vfs/b2/coredatarecovery"
2023/05/03 22:05:51 DEBUG : Creating backend with remote "C:/Users/cored/AppData/Local/rclone/vfsMeta/b2/coredatarecovery"
2023/05/03 22:05:51 DEBUG : fs cache: renaming cache item "C:/Users/cored/AppData/Local/rclone/vfsMeta/b2/coredatarecovery" to be canonical "//?/C:/Users/cored/AppData/Local/rclone/vfsMeta/b2/coredatarecovery"
2023/05/03 22:05:51 DEBUG : Network mode mounting is enabled
2023/05/03 22:05:51 DEBUG : Mounting on "z:" ("\\server\\b2 coredatarecovery")
2023/05/03 22:05:51 DEBUG : B2 bucket coredatarecovery: Mounting with options: ["-o" "attr_timeout=1" "-o" "uid=-1" "-o" "gid=-1" "--FileSystemName=rclone" "--VolumePrefix=\\server\\b2 coredatarecovery"]
2023/05/03 22:05:51 DEBUG : vfs cache RemoveNotInUse (maxAge=3600000000000, emptyOnly=false): item 2020fall basis.txt not removed, freed 0 bytes
2023/05/03 22:05:51 INFO  : vfs cache: cleaned: objects 1 (was 1) in use 0, to upload 0, uploading 0, total size 483 (was 483)
2023/05/03 22:05:51 DEBUG : B2 bucket coredatarecovery: Init:
2023/05/03 22:05:51 DEBUG : B2 bucket coredatarecovery: >Init:
2023/05/03 22:05:51 DEBUG : /: Statfs:
2023/05/03 22:05:51 DEBUG : /: >Statfs: stat={Bsize:4096 Frsize:4096 Blocks:274877906944 Bfree:274877906944 Bavail:274877906944 Files:1000000000 Ffree:1000000000 Favail:0 Fsid:0 Flag:0 Namemax:255}, errc=0
2023/05/03 22:05:51 DEBUG : /: Getattr: fh=0xFFFFFFFFFFFFFFFF
2023/05/03 22:05:51 DEBUG : /: >Getattr: errc=0
2023/05/03 22:05:51 DEBUG : /: Readlink:
2023/05/03 22:05:51 DEBUG : /: >Readlink: linkPath="", errc=-40
2023/05/03 22:05:51 DEBUG : /: Getxattr: name="non-existant-a11ec902d22f4ec49003af15282d3b00"
2023/05/03 22:05:51 DEBUG : /: >Getxattr: errc=-40, value=""
The service rclone has been started.
2023/05/03 22:05:51 DEBUG : /: Getattr: fh=0xFFFFFFFFFFFFFFFF
2023/05/03 22:05:51 DEBUG : /: >Getattr: errc=0
2023/05/03 22:05:51 DEBUG : /: Getattr: fh=0xFFFFFFFFFFFFFFFF
2023/05/03 22:05:51 DEBUG : /: >Getattr: errc=0
2023/05/03 22:05:51 DEBUG : /: Opendir:
2023/05/03 22:05:51 DEBUG : /: OpenFile: flags=O_RDONLY, perm=-rwxrwxrwx
2023/05/03 22:05:51 DEBUG : /: >OpenFile: fd=/ (r), err=<nil>
2023/05/03 22:05:51 DEBUG : /: >Opendir: errc=0, fh=0x0
2023/05/03 22:05:51 DEBUG : /: Releasedir: fh=0x0
2023/05/03 22:05:51 DEBUG : /: >Releasedir: errc=0
2023/05/03 22:05:51 DEBUG : /: Getattr: fh=0xFFFFFFFFFFFFFFFF
2023/05/03 22:05:51 DEBUG : /: >Getattr: errc=0
2023/05/03 22:05:51 DEBUG : /: Getattr: fh=0xFFFFFFFFFFFFFFFF
2023/05/03 22:05:51 DEBUG : /: >Getattr: errc=0
2023/05/03 22:05:51 DEBUG : /: Opendir:
2023/05/03 22:05:51 DEBUG : /: OpenFile: flags=O_RDONLY, perm=-rwxrwxrwx
2023/05/03 22:05:51 DEBUG : /: >OpenFile: fd=/ (r), err=<nil>
2023/05/03 22:05:51 DEBUG : /: >Opendir: errc=0, fh=0x0
2023/05/03 22:05:51 DEBUG : /: Releasedir: fh=0x0
2023/05/03 22:05:51 DEBUG : /: >Releasedir: errc=0
2023/05/03 22:05:51 DEBUG : /: Getattr: fh=0xFFFFFFFFFFFFFFFF
2023/05/03 22:05:51 DEBUG : /: >Getattr: errc=0
2023/05/03 22:05:51 DEBUG : /: Getattr: fh=0xFFFFFFFFFFFFFFFF
2023/05/03 22:05:51 DEBUG : /: >Getattr: errc=0
2023/05/03 22:05:51 DEBUG : /: Opendir:
2023/05/03 22:05:51 DEBUG : /: OpenFile: flags=O_RDONLY, perm=-rwxrwxrwx
2023/05/03 22:05:51 DEBUG : /: >OpenFile: fd=/ (r), err=<nil>
2023/05/03 22:05:51 DEBUG : /: >Opendir: errc=0, fh=0x0
2023/05/03 22:05:51 DEBUG : /: Releasedir: fh=0x0
2023/05/03 22:05:51 DEBUG : /: >Releasedir: errc=0
\\\

rclone mount works with nssm for both gdrive and dropbox fine.

I've tried turning off vfs writes to no avail so I don't think it's related.

When you try to save the file, it opens save as. and complains you don't have permission to write to the file.

Whatever the issue is it seems to be limited to backblaze B2 and i've tested it on ARM-64 as well as intel and it's the same and I've tried it on a domain controlled windows as well as not.

Any suggestions to try would make my day. Thank you in advance for your time and attention.

hello and welcome to the forum,

run rclone.exe as administrator and add this

-o UserName=Administrator -o GroupName="Authenticated Users"

@asdffdsa if that is the solution, maybe we should put that in the docs as it seems to come up quite often. The docs say don't run as Administrator basically!

good idea, let me do some testing, make sure it works and then if you want, i can try to update the docs.

1 Like

Tried adding that to the service thru editing the parameters in regedit and it does the same thing.

I can run it and it works fine as a batch file as the local user with --no-console to vanish the bunch of black windows.

You can use a master batch file to launch each mount batch file like this:
\
Mountall.bat

start cmd /k Call mountm.bat
start cmd /k Call mounto.bat
start cmd /k Call mountp.bat
start cmd /k Call mounts.bat
start cmd /k Call mountt.bat
start cmd /k Call mountz.bat

and mountz.bat might look like this:
rclone mount b2:bucketname z: --network-mode --vfs-cache-mode writes --config=C:\Users(username)\AppData\Roaming\rclone\rclone.conf --no-console

\\

and a shortcut to this batch file and placing it in the C:\Users(username)\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup

is a work around. I was more interested in the fact that I can mount other services and not have this problem but b2 seems to be the only one where I've run into the glitch, hence I reported it here.

Was unable to get this to solve the issue when running as a service.
parameters set to:

mount cb2: Y: --network-mode --vfs-cache-mode writes --config=C:\Users\cored\AppData\Roaming\rclone\rclone.conf --no-console -o UserName=Administrator -o GroupName="Authenticated Users"

(It already works command line, unelevated)

I was mostly interested in starting it as a service so if any user logged into the unit the drives would be mapped there automatically. but when I did this I noticed the bug and haven't been able to figure out why it's an issue.

:+1:

We really need a bit in the docs on how to run rclone mount as Administrator. If we can work out exactly what to do then rclone could detect running as Administrator and adjust or give help.

It doesn't work as user SYSTEM as a service process with those flags, but please let me know after you play with it.

It does work on dropbox as well as google drive without those flags as a user SYSTEM service. the problem seems to only occur with b2 backblaze and b2 crypt.

So it may have to do with that area of the code.

Tried task scheduler running rclone as system

mount cb2: Y: --network-mode --vfs-cache-mode writes --config=C:\Users\cored\AppData\Roaming\rclone\rclone.conf --no-console -o UserName=Administrator -o GroupName="Authenticated Users"

It mounts but same problem in b2

Final solution is all 3 options

-o UserName=Administrator -o GroupName="Authenticated Users" -o FileSecurity="D:P(A;;FA;;;WD)"

Works in task scheduler, works in nssm as a service mount as SYSTEM for all users.

Good job!

@asdffdsa do you think that is a good candidate for the docs as for how to run the mount as Administrator?

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