Username environmental in config

What is the problem you are having with rclone?

Hi im tying to create a setup and backup script for my windows client.
My problem is that i want to make it so that i can use it also on machines with different usernames.
i tried to change inside the config file a part of the path with %username% what is a cmd environment variable for the loggedin username.
i dont really understand the environmental config descriptions and even dont know if i could even use them at a windows machine or only on linux.
when i start my .bat file with the command below in it then its connect with the error of the -vv log and just show a empty folder

What is your rclone version (output from rclone version)

rclone v1.54.1

  • os/arch: windows/amd64
  • go version: go1.15.8
    and also
    rclone v1.55.1
  • os/type: windows
  • os/arch: amd64
  • go/version: go1.16.3
  • go/linking: dynamic
  • go/tags: cmount

Which OS you are using and how many bits (eg Windows 7, 64 bit)

Windows 10 newest version and windows 11 dev inside build

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

Onedrive over windows client (when i dont use the variable and write the path completely, its working)

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

rclone mount --config backup.conf obcrypt: Z: --cache-db-purge --buffer-size 32M --timeout 1h --dir-cache-time 5s --vfs-cache-mode writes

The rclone config contents with secrets removed.

[obcrypt]
type = crypt
remote = C:\Users\%username%\OneDrive\Backup\
filename_encryption = standard
directory_name_encryption = true
password = XXX
password2 = XXX

A log from the command with the -vv flag

2021/07/05 01:31:19 DEBUG : Creating backend with remote "obcrypt:"
2021/07/05 01:31:19 DEBUG : Creating backend with remote "C:\\Users\\%username%\\OneDrive\\Backup\\"
2021/07/05 01:31:19 DEBUG : fs cache: renaming cache item "C:\\Users\\%username%\\OneDrive\\Backup\\" to be canonical "//?/C:/Users/%username%/OneDrive/Backup/"
2021/07/05 01:31:19 INFO  : Encrypted drive 'obcrypt:': poll-interval is not supported by this remote
2021/07/05 01:31:19 DEBUG : vfs cache: root is "\\\\?\\C:\\Users\\Patrick\\AppData\\Local\\rclone\\vfs\\obcrypt"
2021/07/05 01:31:19 DEBUG : vfs cache: metadata root is "\\\\?\\C:\\Users\\Patrick\\AppData\\Local\\rclone\\vfs\\obcrypt"
2021/07/05 01:31:19 DEBUG : Creating backend with remote "\\\\?\\C:\\Users\\Patrick\\AppData\\Local\\rclone\\vfs\\obcrypt"
2021/07/05 01:31:19 DEBUG : fs cache: renaming cache item "\\\\?\\C:\\Users\\Patrick\\AppData\\Local\\rclone\\vfs\\obcrypt" to be canonical "//?/C:/Users/Patrick/AppData/Local/rclone/vfs/obcrypt"
2021/07/05 01:31:19 DEBUG : fs cache: switching user supplied name "\\\\?\\C:\\Users\\Patrick\\AppData\\Local\\rclone\\vfs\\obcrypt" for canonical name "//?/C:/Users/Patrick/AppData/Local/rclone/vfs/obcrypt"
2021/07/05 01:31:19 DEBUG : Network mode mounting is disabled
2021/07/05 01:31:19 DEBUG : Mounting on "Z:" ("obcrypt")
2021/07/05 01:31:19 INFO  : vfs cache: cleaned: objects 0 (was 0) in use 0, to upload 0, uploading 0, total size 0 (was 0)
2021/07/05 01:31:19 DEBUG : Encrypted drive 'obcrypt:': Mounting with options: ["-o" "attr_timeout=1" "-o" "uid=-1" "-o" "gid=-1" "--FileSystemName=rclone" "-o" "volname=obcrypt"]
2021/07/05 01:31:19 DEBUG : Encrypted drive 'obcrypt:': Init:
2021/07/05 01:31:19 DEBUG : Encrypted drive 'obcrypt:': >Init:
2021/07/05 01:31:19 DEBUG : /: Statfs:
2021/07/05 01:31:19 ERROR : Encrypted drive 'obcrypt:': Statfs failed: failed to read disk usage: Das System kann den angegebenen Pfad nicht finden.
2021/07/05 01:31:19 DEBUG : /: >Statfs: stat={Bsize:4096 Frsize:4096 Blocks:8796093022207 Bfree:8796093022207 Bavail:8796093022207 Files:1000000000 Ffree:1000000000 Favail:0 Fsid:0 Flag:0 Namemax:255}, errc=0
2021/07/05 01:31:19 DEBUG : /: Getattr: fh=0xFFFFFFFFFFFFFFFF
2021/07/05 01:31:19 DEBUG : /: >Getattr: errc=0
2021/07/05 01:31:19 DEBUG : /: Readlink:
2021/07/05 01:31:19 DEBUG : /: >Readlink: linkPath="", errc=-40
2021/07/05 01:31:19 DEBUG : /: Statfs:
2021/07/05 01:31:19 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
2021/07/05 01:31:19 DEBUG : /: Getattr: fh=0xFFFFFFFFFFFFFFFF
2021/07/05 01:31:19 DEBUG : /: >Getattr: errc=0
The service rclone has been started.
2021/07/05 01:31:19 DEBUG : /: Getattr: fh=0xFFFFFFFFFFFFFFFF
2021/07/05 01:31:19 DEBUG : /: >Getattr: errc=0
2021/07/05 01:31:19 DEBUG : /: Opendir:
2021/07/05 01:31:19 DEBUG : /: OpenFile: flags=O_RDONLY, perm=-rwxrwxrwx
2021/07/05 01:31:19 DEBUG : /: >OpenFile: fd=/ (r), err=<nil>
2021/07/05 01:31:19 DEBUG : /: >Opendir: errc=0, fh=0x0
2021/07/05 01:31:19 DEBUG : /: Releasedir: fh=0x0
2021/07/05 01:31:19 DEBUG : /: >Releasedir: errc=0
2021/07/05 01:31:19 DEBUG : /: Getattr: fh=0xFFFFFFFFFFFFFFFF
2021/07/05 01:31:19 DEBUG : /: >Getattr: errc=0
2021/07/05 01:31:19 DEBUG : /: Getattr: fh=0xFFFFFFFFFFFFFFFF
2021/07/05 01:31:19 DEBUG : /: >Getattr: errc=0
2021/07/05 01:31:20 DEBUG : /: Opendir:
2021/07/05 01:31:20 DEBUG : /: OpenFile: flags=O_RDONLY, perm=-rwxrwxrwx
2021/07/05 01:31:20 DEBUG : /: >OpenFile: fd=/ (r), err=<nil>
2021/07/05 01:31:20 DEBUG : /: >Opendir: errc=0, fh=0x0
2021/07/05 01:31:20 DEBUG : /: Releasedir: fh=0x0
2021/07/05 01:31:20 DEBUG : /: Getattr: fh=0xFFFFFFFFFFFFFFFF
2021/07/05 01:31:20 DEBUG : /: >Getattr: errc=0
2021/07/05 01:31:20 DEBUG : /: >Releasedir: errc=0
2021/07/05 01:31:20 DEBUG : /: Getattr: fh=0xFFFFFFFFFFFFFFFF
2021/07/05 01:31:20 DEBUG : /: >Getattr: errc=0
2021/07/05 01:31:20 DEBUG : /: Opendir:
2021/07/05 01:31:20 DEBUG : /: OpenFile: flags=O_RDONLY, perm=-rwxrwxrwx
2021/07/05 01:31:20 DEBUG : /: >OpenFile: fd=/ (r), err=<nil>
2021/07/05 01:31:20 DEBUG : /: >Opendir: errc=0, fh=0x0
2021/07/05 01:31:20 DEBUG : /: Releasedir: fh=0x0
2021/07/05 01:31:20 DEBUG : /: >Releasedir: errc=0

Hope someone can help me :slight_smile:
Greetings

hi,

if you are trying to make use of the microsoft windows onedrive client folder, not sure that will work reliably.
imho, no way would i trust backing up critical files to a mount pointing to a crypt inside that.

best to make a onedrive remote and put a crypt remote inside that.

and based on your setup, you can remove --cache-db-purge

but if that is really want you want, you can create a remote on-the-fly, no config file needed

set rclone_config_obcrypt_type=crypt
set rclone_config_obcrypt_remote=C:\Users\%username%\OneDrive\Backup
set rclone_config_obcrypt_filename_encryption=standard
set rclone_config_obcrypt_directory_name_encryption=true
set rclone_config_obcrypt_password=
set rclone_config_obcrypt_password2=
rclone mount obcrypt: z:

yeah it dont look like its so reliably :frowning:
okay now i recreate a onedrive mount that works better.

well these files are not so importent, they are more like a backup if my system should be crashing or i wnat to reinstall it, for that these is okay for me, and i dont like M$ enough to give them all my programms config files and browser profile unencrypted.... especially since you have the "personal safe"

i agree, so it is good that you are using a rclone crypt for those files.

if you want forever forward incremental backups, you might try using --backup-dir

you might want to check my wiki, using VSS with rclone.
https://forum.rclone.org/t/how-to-enable-vss-for-rclone-on-windows/11675

1 Like

these is cool thx for the information!

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