# Different cache dir suffixes for same password

**URL:** <https://forum.rclone.org/t/different-cache-dir-suffixes-for-same-password/41114>\
**Category:** Help and Support\
**Created:** [August 19, 2023, 7:14pm UTC](https://forum.rclone.org/t/different-cache-dir-suffixes-for-same-password/41114 "2023-08-19T19:14:20Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![jleeuwes](https://forum.rclone.org/user_avatar/forum.rclone.org/jleeuwes/32/16057_2.png) [@jleeuwes](https://forum.rclone.org/u/jleeuwes)\
**Post date:** [August 19, 2023, 7:14pm UTC](https://forum.rclone.org/t/different-cache-dir-suffixes-for-same-password/41114/1 "2023-08-19T19:14:20Z")

</div>

#### What is the problem you are having with rclone?

I do not want to store my passwords and salts on disk,  
so I am using environment variables to supply these on the fly  
like this:

```auto
export RCLONE_CRYPT_PASSWORD1=$(command-producing-password | rclone obscure -)
export RCLONE_CRYPT_PASSWORD2=$(command-producing-salt | rclone obscure -)

```

The actual passwords come from my password manager.

Using environment variables triggers a message:

```auto
detected overridden config - adding "{xxxxx}" suffix to name

```

Problem is: this suffix is different every time I mount, which causes two problems:

1. A lot of `vfs/storagebox-crypt{xxxxx}` dirs build up in the cache directory  
that take up space and never get cleaned up.
2. Not-yet-uploaded files waiting in those dirs that never get 'resumed'  
so won't get written to the remote.

I'm guessing the suffix is based on the hash of the obscured salt,  
which is different every time I run `rclone obscure`.  
I order to prevent this I would have to store the obscured password in my password manager, next to the actual password.  
I guess I could do that, but I'm wondering if this is the correct solution.

I can think of the following solutions on the rclone side:

1. Don't hash obscured passwords and salts, but 'decrypt' them first.
2. Don't hash passwords at all and ignore them when producing the suffix.
3. Don't require obfuscation of passwords and salts in environment variables. This would be difficult to do while being backwards compatible.
4. Make `rclone obscure` deterministic.

Option 3 would be more of a workaround.

A combination of 1 and 2 might be needed: I'm guessing a changed salt  
doesn't have an influence on accessing existing encrypted content  
but a changed password does.

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

```auto
rclone 1.62.2
- os/version: nixos 23.05 (Stoat) (64 bit)
- os/kernel: 6.1.38 (x86_64)
- os/type: linux
- os/arch: amd64
- go/version: go1.20.6
- go/linking: dynamic
- go/tags: cmount

```

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

Webdav (Hetzner storagebox) + crypt

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

Obtaining the actual salt is left out here.  
Here I'm directly passing the salt to make things simpler:

```auto
export RCLONE_CRYPT_PASSWORD2=$(rclone obscure xxxxxxxxxxxxx)
rclone mount -vv --config=rclone.conf --vfs-cache-mode writes storagebox-crypt: crypt-mount/

```

#### The rclone config contents with secrets removed.

```auto
[storagebox]
type = webdav
url = https://xxxxx.your-storagebox.de
vendor = other
user = xxxxx
pass = xxxxx

[storagebox-crypt]
type = crypt
remote = storagebox:probeer
password = xxxxx
password2 = xxxxx

```

#### A log from the command with the `-vv` flag

Run 1:

```auto
2023/08/19 20:36:49 DEBUG : Setting default for crypt-password2="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" from environment variable RCLONE_CRYPT_PASSWORD2
2023/08/19 20:36:49 DEBUG : rclone: Version "1.62.2" starting with parameters ["/run/current-system/sw/bin/rclone" "mount" "-vv" "--config=rclone.conf" "--vfs-cache-mode" "writes" "storagebox-crypt:" "crypt-mount/"]
2023/08/19 20:36:49 DEBUG : Creating backend with remote "storagebox-crypt:"
2023/08/19 20:36:49 DEBUG : Using config file from "/home/jeroen/meuk/rclone-gocryptfs/rclone.conf"
2023/08/19 20:36:49 DEBUG : Setting crypt_password2="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" from environment variable RCLONE_CRYPT_PASSWORD2
2023/08/19 20:36:49 DEBUG : storagebox-crypt: detected overridden config - adding "{84U5l}" suffix to name
2023/08/19 20:36:49 DEBUG : Setting crypt_password2="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" from environment variable RCLONE_CRYPT_PASSWORD2
2023/08/19 20:36:50 DEBUG : Creating backend with remote "storagebox:probeer"
2023/08/19 20:36:50 DEBUG : found headers: 
2023/08/19 20:36:50 DEBUG : fs cache: renaming cache item "storagebox-crypt:" to be canonical "storagebox-crypt{84U5l}:"
2023/08/19 20:36:50 INFO : Encrypted drive 'storagebox-crypt{84U5l}:': poll-interval is not supported by this remote
2023/08/19 20:36:50 DEBUG : vfs cache: root is "/home/jeroen/.cache/rclone"
2023/08/19 20:36:50 DEBUG : vfs cache: data root is "/home/jeroen/.cache/rclone/vfs/storagebox-crypt{84U5l}"
2023/08/19 20:36:50 DEBUG : vfs cache: metadata root is "/home/jeroen/.cache/rclone/vfsMeta/storagebox-crypt{84U5l}"
2023/08/19 20:36:50 DEBUG : Creating backend with remote "/home/jeroen/.cache/rclone/vfs/storagebox-crypt{84U5l}/"
2023/08/19 20:36:50 DEBUG : fs cache: renaming cache item "/home/jeroen/.cache/rclone/vfs/storagebox-crypt{84U5l}/" to be canonical "/home/jeroen/.cache/rclone/vfs/storagebox-crypt{84U5l}"
2023/08/19 20:36:50 DEBUG : Creating backend with remote "/home/jeroen/.cache/rclone/vfsMeta/storagebox-crypt{84U5l}/"
2023/08/19 20:36:50 DEBUG : fs cache: renaming cache item "/home/jeroen/.cache/rclone/vfsMeta/storagebox-crypt{84U5l}/" to be canonical "/home/jeroen/.cache/rclone/vfsMeta/storagebox-crypt{84U5l}"
2023/08/19 20:36:50 INFO : vfs cache: cleaned: objects 0 (was 0) in use 0, to upload 0, uploading 0, total size 0 (was 0)
2023/08/19 20:36:50 DEBUG : Encrypted drive 'storagebox-crypt{84U5l}:': Mounting on "crypt-mount/"

```

Run 2, different suffix:

```auto
2023/08/19 20:40:02 DEBUG : Setting default for crypt-password2="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" from environment variable RCLONE_CRYPT_PASSWORD2
2023/08/19 20:40:02 DEBUG : rclone: Version "1.62.2" starting with parameters ["/run/current-system/sw/bin/rclone" "mount" "-vv" "--config=rclone.conf" "--vfs-cache-mode" "writes" "storagebox-crypt:" "crypt-mount/"]
2023/08/19 20:40:02 DEBUG : Creating backend with remote "storagebox-crypt:"
2023/08/19 20:40:02 DEBUG : Using config file from "/home/jeroen/meuk/rclone-gocryptfs/rclone.conf"
2023/08/19 20:40:02 DEBUG : Setting crypt_password2="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" from environment variable RCLONE_CRYPT_PASSWORD2
2023/08/19 20:40:02 DEBUG : storagebox-crypt: detected overridden config - adding "{gy3BQ}" suffix to name
2023/08/19 20:40:02 DEBUG : Setting crypt_password2="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" from environment variable RCLONE_CRYPT_PASSWORD2
2023/08/19 20:40:02 DEBUG : Creating backend with remote "storagebox:probeer"
2023/08/19 20:40:02 DEBUG : found headers: 
2023/08/19 20:40:02 DEBUG : fs cache: renaming cache item "storagebox-crypt:" to be canonical "storagebox-crypt{gy3BQ}:"
2023/08/19 20:40:02 INFO : Encrypted drive 'storagebox-crypt{gy3BQ}:': poll-interval is not supported by this remote
2023/08/19 20:40:02 DEBUG : vfs cache: root is "/home/jeroen/.cache/rclone"
2023/08/19 20:40:02 DEBUG : vfs cache: data root is "/home/jeroen/.cache/rclone/vfs/storagebox-crypt{gy3BQ}"
2023/08/19 20:40:02 DEBUG : vfs cache: metadata root is "/home/jeroen/.cache/rclone/vfsMeta/storagebox-crypt{gy3BQ}"
2023/08/19 20:40:02 DEBUG : Creating backend with remote "/home/jeroen/.cache/rclone/vfs/storagebox-crypt{gy3BQ}/"
2023/08/19 20:40:02 DEBUG : fs cache: renaming cache item "/home/jeroen/.cache/rclone/vfs/storagebox-crypt{gy3BQ}/" to be canonical "/home/jeroen/.cache/rclone/vfs/storagebox-crypt{gy3BQ}"
2023/08/19 20:40:02 DEBUG : Creating backend with remote "/home/jeroen/.cache/rclone/vfsMeta/storagebox-crypt{gy3BQ}/"
2023/08/19 20:40:02 DEBUG : fs cache: renaming cache item "/home/jeroen/.cache/rclone/vfsMeta/storagebox-crypt{gy3BQ}/" to be canonical "/home/jeroen/.cache/rclone/vfsMeta/storagebox-crypt{gy3BQ}"
2023/08/19 20:40:02 INFO : vfs cache: cleaned: objects 0 (was 0) in use 0, to upload 0, uploading 0, total size 0 (was 0)
2023/08/19 20:40:02 DEBUG : Encrypted drive 'storagebox-crypt{gy3BQ}:': Mounting on "crypt-mount/"

```

---

<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:** [August 19, 2023, 7:50pm UTC](https://forum.rclone.org/t/different-cache-dir-suffixes-for-same-password/41114/2 "2023-08-19T19:50:47Z")

</div>

welcome to the forum,

> [@jleeuwes](#):
>
> I order to prevent this I would have to store the obscured password in my password manager, next to the actual password.  
> I guess I could do that, but I'm wondering if this is the correct solution.

that is what i would do.  
would be curious if there is a better solution or any other solution at all.

* * *

fwiw, this is the rclone source code  
[https://github.com/rclone/rclone/blob/156c372cd760460f419708c75506434c48decfc8/fs/newfs.go#L43](https://github.com/rclone/rclone/blob/156c372cd760460f419708c75506434c48decfc8/fs/newfs.go#L43)

---

<div class="post-metadata">

**Author:** ![jleeuwes](https://forum.rclone.org/user_avatar/forum.rclone.org/jleeuwes/32/16057_2.png) [@jleeuwes](https://forum.rclone.org/u/jleeuwes)\
**Post date:** [August 30, 2023, 1:25pm UTC](https://forum.rclone.org/t/different-cache-dir-suffixes-for-same-password/41114/3 "2023-08-30T13:25:00Z")

</div>

I worked around this problem by generating a config file on-the-fly on a ramfs. When rclone is using a config file, it doesn't add a suffix to the cache dir name, even though the obscured password is different everytime.

Still, it feels a bit wrong to have to put passwords in a 'file' instead of using a more ephemeral mechanism like environment variables, which seem more suited for passing secret information.

I can try to make an PR to hash the config after un-obscuring the passwords. But I will only do that if more people think this is a good idea in principle.

---

<div class="post-metadata">

**Author:** ![kapitainsky](https://forum.rclone.org/user_avatar/forum.rclone.org/kapitainsky/32/14450_2.png) [@kapitainsky](https://forum.rclone.org/u/kapitainsky)\
**Post date:** [August 30, 2023, 1:43pm UTC](https://forum.rclone.org/t/different-cache-dir-suffixes-for-same-password/41114/4 "2023-08-30T13:43:14Z")

</div>

> [@jleeuwes](#):
>
> `export RCLONE_CRYPT_PASSWORD2=$(rclone obscure xxxxxxxxxxxxx)`

Why do you insist on storing `xxxxxxxxxxxxx` instead of `rclone obscure xxxxxxxxxxxxx`? It is not needed for anything.

If for whatever reason one day you need `xxxxxxxxxxxxx` you can decode it (it is not really encrypted):

[https://forum.rclone.org/t/how-to-retrieve-a-crypt-password-from-a-config-file/](https://forum.rclone.org/t/how-to-retrieve-a-crypt-password-from-a-config-file/)

---

<div class="post-metadata">

**Author:** ![jleeuwes](https://forum.rclone.org/user_avatar/forum.rclone.org/jleeuwes/32/16057_2.png) [@jleeuwes](https://forum.rclone.org/u/jleeuwes)\
**Post date:** [August 30, 2023, 3:27pm UTC](https://forum.rclone.org/t/different-cache-dir-suffixes-for-same-password/41114/5 "2023-08-30T15:27:58Z")

</div>

> [@kapitainsky](#):
>
> Why do you insist on storing `xxxxxxxxxxxxx` instead of `rclone obscure xxxxxxxxxxxxx`? It is not needed for anything.

I usually store only passwords, not information derived from passwords. I could consider the obscured password to be the password, but I would have to be absolutely sure the current obscuring algorithm will remain supported forever. Or I would have to store both the obscured and non-obscured password, but I prefer to have a single source of truth.

---

<div class="post-metadata">

**Author:** ![kapitainsky](https://forum.rclone.org/user_avatar/forum.rclone.org/kapitainsky/32/14450_2.png) [@kapitainsky](https://forum.rclone.org/u/kapitainsky)\
**Post date:** [August 30, 2023, 3:49pm UTC](https://forum.rclone.org/t/different-cache-dir-suffixes-for-same-password/41114/6 "2023-08-30T15:49:38Z")

</div>

> [@jleeuwes](#):
>
> but I would have to be absolutely sure the current obscuring algorithm will remain supported forever

IMHO nobody will give you 100% guarantee that things will stay the way you like.

One solution would be to fork `rclone` repo and maintain your custom version.

---

<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:** [August 30, 2023, 4:16pm UTC](https://forum.rclone.org/t/different-cache-dir-suffixes-for-same-password/41114/7 "2023-08-30T16:16:09Z")

</div>

> [@jleeuwes](#):
>
> I worked around this problem by generating a config file on-the-fly on a ramfs. When rclone is using a config file, it doesn't add a suffix to the cache dir name, even though the obscured password is different everytime.

nice workaround!  
fwiw, with my backup script, i create on-the-fly remotes, do not use config file at all.

---

<div class="post-metadata">

**Author:** ![jleeuwes](https://forum.rclone.org/user_avatar/forum.rclone.org/jleeuwes/32/16057_2.png) [@jleeuwes](https://forum.rclone.org/u/jleeuwes)\
**Post date:** [September 20, 2023, 1:40pm UTC](https://forum.rclone.org/t/different-cache-dir-suffixes-for-same-password/41114/8 "2023-09-20T13:40:30Z")

</div>

> [@asdffdsa](#):
>
> fwiw, with my backup script, i create on-the-fly remotes, do not use config file at all.

That would be my ideal too. How do you pass your password to rclone?

---

<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:** [September 20, 2023, 2:03pm UTC](https://forum.rclone.org/t/different-cache-dir-suffixes-for-same-password/41114/9 "2023-09-20T14:03:21Z")

</div>

> [@jleeuwes](#):
>
> That would be my ideal too. How do you pass your password to rclone?

if there is no config, then there is no config password.

---

<div class="post-metadata">

**Author:** ![jleeuwes](https://forum.rclone.org/user_avatar/forum.rclone.org/jleeuwes/32/16057_2.png) [@jleeuwes](https://forum.rclone.org/u/jleeuwes)\
**Post date:** [September 20, 2023, 3:58pm UTC](https://forum.rclone.org/t/different-cache-dir-suffixes-for-same-password/41114/10 "2023-09-20T15:58:17Z")

</div>

> [@asdffdsa](#):
>
> > [@jleeuwes](#):
> >
> > That would be my ideal too. How do you pass your password to rclone?
> 
> if there is no config, then there is no config password.

Sorry, I meant an encryption password.

---

<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:** [September 20, 2023, 4:01pm UTC](https://forum.rclone.org/t/different-cache-dir-suffixes-for-same-password/41114/11 "2023-09-20T16:01:41Z")

</div>

> [@jleeuwes](#):
>
> Sorry, I meant an encryption password.

```auto
export RCLONE_CONFIG_STORAGEBOX-CRYPT_TYPE=crypt
export RCLONE_CONFIG_STORAGEBOX-CRYPT_REMOTE=storagebox:probeer
export RCLONE_CONFIG_STORAGEBOX-CRYPT_PASSWORD=xxxxx
export RCLONE_CONFIG_STORAGEBOX-CRYPT_PASSWORD2=xxxxx

```

or could use a connection string, tho i would not recommend that.

---

<div class="post-metadata">

**Author:** ![WawP6](https://forum.rclone.org/letter_avatar_proxy/v4/letter/w/d9b06d/32.png) [@WawP6](https://forum.rclone.org/u/WawP6)\
**Post date:** [September 21, 2023, 4:55am UTC](https://forum.rclone.org/t/different-cache-dir-suffixes-for-same-password/41114/12 "2023-09-21T04:55:51Z")

</div>

env vars offers nothing over disk. Instead of access, you have scope. Data or environment. That feeling of it being wrong with ramfs is a good sign. Dont use env vars unless you have that same feeling 😛

---

<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:** [October 21, 2023, 4:56am UTC](https://forum.rclone.org/t/different-cache-dir-suffixes-for-same-password/41114/13 "2023-10-21T04:56:52Z")

</div>

Closed on October 21, 2023, 4:56am UTC

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