# Username environmental in config

**URL:** <https://forum.rclone.org/t/username-environmental-in-config/25150>\
**Category:** Help and Support\
**Created:** [July 4, 2021, 11:34pm UTC](https://forum.rclone.org/t/username-environmental-in-config/25150 "2021-07-04T23:34:55Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Xyz00777](https://forum.rclone.org/letter_avatar_proxy/v4/letter/x/e95f7d/32.png) [@Xyz00777](https://forum.rclone.org/u/Xyz00777)\
**Post date:** [July 4, 2021, 11:34pm UTC](https://forum.rclone.org/t/username-environmental-in-config/25150/1 "2021-07-04T23:34:55Z")

</div>

#### 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](https://rclone.org/docs/#config-file) 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`)

```auto
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.

```auto
[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

```auto
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 🙂  
Greetings

---

<div class="post-metadata">

**Author:** ![asdffdsa](https://forum.rclone.org/letter_avatar_proxy/v4/letter/a/848f3c/32.png) [@asdffdsa](https://forum.rclone.org/u/asdffdsa)\
**Post date:** [July 4, 2021, 11:51pm UTC](https://forum.rclone.org/t/username-environmental-in-config/25150/2 "2021-07-04T23:51:35Z")

</div>

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

```auto
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:

```

---

<div class="post-metadata">

**Author:** ![Xyz00777](https://forum.rclone.org/letter_avatar_proxy/v4/letter/x/e95f7d/32.png) [@Xyz00777](https://forum.rclone.org/u/Xyz00777)\
**Post date:** [July 5, 2021, 2:48pm UTC](https://forum.rclone.org/t/username-environmental-in-config/25150/3 "2021-07-05T14:48:19Z")

</div>

yeah it dont look like its so reliably ☹  
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"

---

<div class="post-metadata">

**Author:** ![asdffdsa](https://forum.rclone.org/letter_avatar_proxy/v4/letter/a/848f3c/32.png) [@asdffdsa](https://forum.rclone.org/u/asdffdsa)\
**Post date:** [July 5, 2021, 2:51pm UTC](https://forum.rclone.org/t/username-environmental-in-config/25150/4 "2021-07-05T14:51:13Z")

</div>

> [@Xyz00777](#):
>
> unencrypted

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](https://forum.rclone.org/t/how-to-enable-vss-for-rclone-on-windows/11675)

---

<div class="post-metadata">

**Author:** ![Xyz00777](https://forum.rclone.org/letter_avatar_proxy/v4/letter/x/e95f7d/32.png) [@Xyz00777](https://forum.rclone.org/u/Xyz00777)\
**Post date:** [July 5, 2021, 3:00pm UTC](https://forum.rclone.org/t/username-environmental-in-config/25150/5 "2021-07-05T15:00:18Z")

</div>

these is cool thx for the information!

---

<div class="post-metadata">

**Author:** ![system](https://forum.rclone.org/uploads/default/original/2X/3/39ad3235f6ffec76ccd0c81616bd55697b4c300d.png) [@system](https://forum.rclone.org/u/system)\
**Post date:** [September 4, 2021, 11:00am UTC](https://forum.rclone.org/t/username-environmental-in-config/25150/6 "2021-09-04T11:00:46Z")

</div>

Closed on September 4, 2021, 11:00am UTC

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