What is the problem you are having with rclone?
Copying into an encrypted local remote using directory name encryption has unexpected behaviour with both absolute and relative destination paths.
What is your rclone version (output from rclone version
)
rclone v1.51.0
- os/arch: linux/amd64
- go version: go1.13.7
Which OS you are using and how many bits (eg Windows 7, 64 bit)
Fedora 30, 64 bit
Which cloud storage system are you using? (eg Google Drive)
Local encrypted remote
The command you were trying to run (eg rclone copy /tmp remote:tmp
)
I started with a new config file:
[local]
type = local
[local-crypt]
type = crypt
remote = local:
password = <generated>
password2 = <generated>
Example 1
Trying to =rclone-copy= into an encrypted absolute path:
\rclone --crypt-directory-name-encryption=true copy /home/user/Downloads/document.pdf local-crypt:/home/user/tmp/rclone-test/encrypted/
Gives this error:
2020/05/16 13:19:55 ERROR : document.pdf: Failed to copy: mkdir /do6rdo23ulutrppoal3nf8kelg: permission denied
2020/05/16 13:19:55 ERROR : Attempt 1/3 failed with 1 errors and: mkdir /do6rdo23ulutrppoal3nf8kelg: permission denied
2020/05/16 13:19:55 ERROR : document.pdf: Failed to copy: mkdir /do6rdo23ulutrppoal3nf8kelg: permission denied
2020/05/16 13:19:55 ERROR : Attempt 2/3 failed with 1 errors and: mkdir /do6rdo23ulutrppoal3nf8kelg: permission denied
2020/05/16 13:19:55 ERROR : document.pdf: Failed to copy: mkdir /do6rdo23ulutrppoal3nf8kelg: permission denied
2020/05/16 13:19:55 ERROR : Attempt 3/3 failed with 1 errors and: mkdir /do6rdo23ulutrppoal3nf8kelg: permission denied
2020/05/16 13:19:55 Failed to copy: mkdir /do6rdo23ulutrppoal3nf8kelg: permission denied
I believe what's happening is rclone encrypts the entire destination path /home/user/tmp/rclone-test/encrypted
and attempts to copy document.pdf to it. Therefore /home
becomes /do6rdo23ulutrppoal3nf8kelg
, which doesn't exist as a root level folder and it fails with permission denied.
The expected behaviour is for only an encrypted version of document.pdf to be placed in the encrypted folder. If I change the directory name encryption to false, rclone correctly places an encrypted file in /home/user/tmp/rclone-test/encrypted
.
Example 2
If I perform the same operation but issue the command from /home/user/tmp/rclone-test
, the above error does not occur.
cd /home/user/tmp/rclone-test
\rclone --crypt-directory-name-encryption=true copy /home/user/Downloads/document.pdf local-crypt:encrypted/
Again the expected behaviour is for an encrypted copy to be placed in /home/user/tmp/rclone-test/encrypted/
, but instead the encrypted file is placed in /home/user/tmp/rclone-test/12oukp3fve3a7hli0tns2mtk14
.
It seems the only way I can get the files in the intended destination dir is to cd there first, before issuing rclone copy
.
Example 3
The same problem occurs in reverse when I want to decrypt the files, for example through rclone ncdu
or rclone mount
.
I have to issue the ncdu or mount with exactly the same relative path as I originally used to copy the files into the encrypted store, otherwise rclone doesn't decrypt the files.
Question
I can work around these with multiple encrypted local remotes for multiple hardcoded destination paths, but it would be preferable if I could use a single local-crypt remote that can copy an encrypted file to whatever path I specify on the command line.
I'd appreciate any feedback whether this is intended behaviour, or a bug, or I'm just doing something wrong.