rclone: Single-file copy failed with access denied when folder copy succeeds
The associated forum post URL from https://forum.rclone.org
https://forum.rclone.org/t/s3-rclone-v-1-52-0-or-after-permission-denied/21961/13
What is the problem you are having with rclone?
Inconsistent behavior when using copy command for copying a folder as opposed to copying a single file.
The symptom is that copying a single file fails (but succeeds when copying a folder to the same remote).
The root-cause is that RCLONE tries to create the remote path (to avoid multiple API calls probably), which means attempting to create a remote bucket (a permission that is rarely given when using cloud storage). When that permission isn’t given for the user, even if the bucket exists, cloud providers (e.g. S3) will return a “permission denied” error.
This does not happen when copying a folder, as it seems like RCLONE always tries to list the remote folder prior to trying to copy. So if the bucket exists it will not attempt creating it.
Options to fix raised by @ncw :
- Avoid creating a bucket altogether, unless
mkdiris used. This is probably not a good idea as it’s backwards incompatible. - Listing the remote folder prior to copying a single file. This is also a behavior change, as it adds an API call to single file copy operations (how frequent really is that?). Probably the cleanest option (there’s the question of handling list permissions… need to look into that and I’ll be happy to help).
- Using the same existing flow (attempt creating remote path, thus implicitly creating the bucket), but doing something different upon retry (assuming the bucket exist maybe). According to Nick, this is probably more complex.
Personally, I believe option #2 is the cleanest, both with respect to consistency with the copy behavior when copying a folder, and avoiding unneeded retries.
What is your rclone version (output from rclone version)
v1.55.0
Which OS you are using and how many bits (e.g. Windows 7, 64 bit)
MacOS Catalina 10.15.7 (but I’m sure this behavior is the same)
Which cloud storage system are you using? (e.g. Google Drive)
AWS S3
The command you were trying to run (e.g. rclone copy /tmp remote:tmp)
The failed command (copying a single file):
╰─$ rclone copy -vv bla/bla.txt s3-guy-test:guyarad-test
2021/04/23 21:43:24 DEBUG : Using config file from "/Users/guyarad/.config/rclone/rclone.conf"
2021/04/23 21:43:24 DEBUG : rclone: Version "v1.55.0" starting with parameters ["rclone" "copy" "-vv" "bla/bla.txt" "s3-guy-test:guyarad-test"]
2021/04/23 21:43:24 DEBUG : Creating backend with remote "bla/bla.txt"
2021/04/23 21:43:24 DEBUG : fs cache: adding new entry for parent of "bla/bla.txt", "/Users/guyarad/src/bla"
2021/04/23 21:43:24 DEBUG : Creating backend with remote "s3-guy-test:guyarad-test"
2021/04/23 21:43:25 DEBUG : bla.txt: Need to transfer - File not found at Destination
2021/04/23 21:43:25 ERROR : bla.txt: Failed to copy: AccessDenied: Access Denied
status code: 403, request id: EFK8TVZQ5HQTCH50, host id: j2tCf5VV9A/ChbRSE+eSY4cKsF/V690LMhQzL2VmegXaQVMxVC/31OgJqt95EDu0pbVcETVBJCo=
2021/04/23 21:43:25 ERROR : Attempt 1/3 failed with 1 errors and: AccessDenied: Access Denied
status code: 403, request id: EFK8TVZQ5HQTCH50, host id: j2tCf5VV9A/ChbRSE+eSY4cKsF/V690LMhQzL2VmegXaQVMxVC/31OgJqt95EDu0pbVcETVBJCo=
... RETRIES OMITTED ...
2021/04/23 21:43:25 INFO :
Transferred: 0 / 0 Bytes, -, 0 Bytes/s, ETA -
Errors: 1 (retrying may help)
Elapsed time: 1.6s
2021/04/23 21:43:25 DEBUG : 6 go routines active
2021/04/23 21:43:25 Failed to copy: AccessDenied: Access Denied
status code: 403, request id: EFK822P9G8PJKPYF, host id: DvXHGARYgOW/8HFrf9iogUWMxvLxShAhMQ4AlPchDuPwNqweAXeyKPl4UbLDOaOX+IISOUJBENE=
Successful copy with the same remote (copying a folder):
╰─$ rclone copy -vv bla/ s3-guy-test:guyarad-test
2021/04/23 21:47:09 DEBUG : Using config file from "/Users/guyarad/.config/rclone/rclone.conf"
2021/04/23 21:47:09 DEBUG : rclone: Version "v1.55.0" starting with parameters ["rclone" "copy" "-vv" "bla/" "s3-guy-test:guyarad-test"]
2021/04/23 21:47:09 DEBUG : Creating backend with remote "bla/"
2021/04/23 21:47:09 DEBUG : fs cache: renaming cache item "bla/" to be canonical "/Users/guyarad/src/bla"
2021/04/23 21:47:09 DEBUG : Creating backend with remote "s3-guy-test:guyarad-test"
2021/04/23 21:47:10 DEBUG : S3 bucket guyarad-test: Waiting for checks to finish
2021/04/23 21:47:10 DEBUG : S3 bucket guyarad-test: Waiting for transfers to finish
2021/04/23 21:47:10 DEBUG : bla.txt: MD5 = 3cd7a0db76ff9dca48979e24c39b408c OK
2021/04/23 21:47:10 INFO : bla.txt: Copied (new)
2021/04/23 21:47:10 INFO :
Transferred: 4 / 4 Bytes, 100%, 12 Bytes/s, ETA 0s
Transferred: 1 / 1, 100%
Elapsed time: 1.1s
2021/04/23 21:47:10 DEBUG : 6 go routines active
After adding CreateBucket policy to the same user being used
(single-file copy operation succeeds)
╰─$ rclone copy -vv bla/bla.txt s3-guy-test:guyarad-test
2021/04/23 21:19:09 DEBUG : Using config file from "/Users/guyarad/.config/rclone/rclone.conf"
2021/04/23 21:19:09 DEBUG : rclone: Version "v1.55.0" starting with parameters ["rclone" "copy" "-vv" "bla/bla.txt"
2021/04/23 21:19:09 DEBUG : Creating backend with remote "bla/bla.txt"
2021/04/23 21:19:09 DEBUG : fs cache: adding new entry for parent of "bla/bla.txt", "/Users/guyarad/src/bla"
2021/04/23 21:19:09 DEBUG : Creating backend with remote "s3-guy-test:guyarad-test"
2021/04/23 21:19:10 DEBUG : bla.txt: Need to transfer - File not found at Destination
2021/04/23 21:19:10 INFO : S3 bucket guyarad-test: Bucket "guyarad-test" created with ACL "private"
2021/04/23 21:19:11 DEBUG : bla.txt: MD5 = 3cd7a0db76ff9dca48979e24c39b408c OK
2021/04/23 21:19:11 INFO : bla.txt: Copied (new)
2021/04/23 21:19:11 INFO :
Transferred: 4 / 4 Bytes, 100%, 6 Bytes/s, ETA 0s
Transferred: 1 / 1, 100%
Elapsed time: 1.4s
2021/04/23 21:19:11 DEBUG : 6 go routines active
Thanks guys for the awesome tool!!
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 2
- Comments: 15 (6 by maintainers)
still exist in v1.61.1 need
--s3-no-check-bucketto skip errorI think this is worth fixing as it has caused a fair amount of annoyance to users in the past.
Note that we only need to list the root of the bucket once - rclone has a cache of whether the bucket has been created or not so instead of
Rclone will do
So in the normal case of the bucket already existing it will do no extra API calls compared to current
Most syncs involve listing the bucket anyway - it is possible to do it without but I think most syncs will have list bucket permissions. And there is always
--s3-no-check-bucketfor those difficult to reach edge cases!@ncw