Permission Denied when running " rclone copy"

Hi,

First, thanks for your time if you are reading this. Main scope : backup some file each week/month on OneDrive from a VPS.

I'm having some problems with rclone when trying to use either copy or move.
I'm able to list the files/folders from my OneDrive location so i assume the configuration is fine.

I created a repository on my OneDrive, i did a snapshot, i can see the snapshot in the command line BUT i want to simply copy some files at a certain time to OneDrive OR sync the entire folder from a VPS machine.

Keep getting permision denied when i'm trying to copy/move from VPS to OneDrive location. I did some searches but i cannot find anyone with this kind of the problem.
My file is owned by root and has 777. I'm running rclone copy with root user. What i'm doing wrong ?

What is the problem you are having with rclone?

Getting "permission denied" when executing rclone -vv copy /home/test.html remote:test_folder with user "root".

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

rclone v1.63.1

  • os/version: ubuntu 16.04 (64 bit)
  • os/kernel: 4.4.0-203-generic (x86_64)
  • os/type: linux
  • os/arch: amd64
  • go/version: go1.20.7
  • go/linking: static
  • go/tags: none

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

OneDrive

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

rclone -vv copy /home/test.html remote:test_folder

Please run 'rclone config redacted' and share the full output. If you get command not found, please make sure to update rclone.

*I cannot update because i installed rclone with snap, getting this when running "rclone selfupdate " - /snap/rclone/471/bin/rclone: file is not writable, run self-update as root *
If really needed i will uninstall and install again rclone.
Config file :

[remote]
type = onedrive
token = {"access_token":"my_token etc " }
drive_id = my_drive_id
drive_type = business

A log from the command that you were trying to run with the -vv flag


2023/09/15 15:45:35 DEBUG : rclone: Version "v1.63.1" starting with parameters ["/snap/rclone/471/bin/rclone" "-vv" "copy" "/home/test.html" "remote:test_folder"]
2023/09/15 15:45:35 DEBUG : Creating backend with remote "/home/test.html"
2023/09/15 15:45:35 DEBUG : Using config file from "/root/snap/rclone/471/.config/rclone/rclone.conf"
2023/09/15 15:45:35 DEBUG : fs cache: adding new entry for parent of "/home/test.html", "/home"
2023/09/15 15:45:35 DEBUG : Creating backend with remote "remote:test_folder"
2023/09/15 15:45:36 DEBUG : test.html: Need to transfer - File not found at Destination
2023/09/15 15:45:36 ERROR : test.html: Failed to copy: failed to open source object: open /home/test.html: permission denied
2023/09/15 15:45:36 ERROR : Attempt 1/3 failed with 1 errors and: failed to open source object: open /home/test.html: permission denied
2023/09/15 15:45:36 DEBUG : test.html: Need to transfer - File not found at Destination
2023/09/15 15:45:36 ERROR : test.html: Failed to copy: failed to open source object: open /home/test.html: permission denied
2023/09/15 15:45:36 ERROR : Attempt 2/3 failed with 1 errors and: failed to open source object: open /home/test.html: permission denied
2023/09/15 15:45:36 DEBUG : test.html: Need to transfer - File not found at Destination
2023/09/15 15:45:36 ERROR : test.html: Failed to copy: failed to open source object: open /home/test.html: permission denied
2023/09/15 15:45:36 ERROR : Attempt 3/3 failed with 1 errors and: failed to open source object: open /home/test.html: permission denied
2023/09/15 15:45:36 INFO  :
Transferred:              0 B / 0 B, -, 0 B/s, ETA -
Errors:                 1 (retrying may help)
Elapsed time:         0.8s

2023/09/15 15:45:36 DEBUG : 8 go routines active
2023/09/15 15:45:36 Failed to copy: failed to open source object: open /home/test.html: permission denied

Any suggestions ?
With what user i should execute rclone copy/move/sync ?
What permissions should have the file/folder i'm looking to copy/move/sync ?

Thank you very much !

welcome to the forum,

can you copy that file, not using rclone?

i just tested the snap version of rclone, had no issue copying a file from /home

I tried sudo, nothing changes.

I'm able to copy that specific file to a new folder in the vps machine, no probl.

Thanks for testing the snap version.

LE: Can it be related to the fact that i made the configuration with the help of a windows laptop ? I used rclone docs to get the link and authorization codes.

no, no need for config. do a local to local copy

/snap/rclone/current/bin/rclone copy /home/file.ext ./test -vv --config=doesnotexist.conf
2023/09/15 10:41:21 DEBUG : rclone: Version "v1.63.1" starting with parameters ["/snap/rclone/current/bin/rclone" "copy" "/home/file.ext" "./test" "-vv" "--config=doesnotexist.conf"]
2023/09/15 10:41:21 DEBUG : Creating backend with remote "/home/file.ext"
2023/09/15 10:41:21 NOTICE: Config file "/root/doesnotexist.conf" not found - using defaults
2023/09/15 10:41:21 DEBUG : fs cache: adding new entry for parent of "/home/file.ext", "/home"
2023/09/15 10:41:21 DEBUG : Creating backend with remote "./test"
2023/09/15 10:41:21 DEBUG : fs cache: renaming cache item "./test" to be canonical "/root/test"
2023/09/15 10:41:21 DEBUG : file.ext: Need to transfer - File not found at Destination
2023/09/15 10:41:21 DEBUG : file.ext: md5 = d41d8cd98f00b204e9800998ecf8427e OK
2023/09/15 10:41:21 DEBUG : file.ext.gevoleq7.partial: renamed to: file.ext
2023/09/15 10:41:21 INFO  : file.ext: Copied (new)

no need to uninstall/install. rclone is a portable executable. download and execute.
i would do a quick test using that.

I did a local test , works fine. No problems in copying the file from a folder to another.

Any reason you are using OS released in 2015? Its end of life was 3 years ago... Not sure if latest rclone can run without issues. You could try some older version of rclone.

Also you should try rclone installed directly from Rclone downloads. Snap is heavily sandboxed environment with very strict restrictions what you can access/do and what not. It is possible that your OS configuration is "weird" (highly probable given out of date OS) or old snap is totally broken by now and your /home folder is outside of rclone/snap scope.

you did that test with rclone or what?

can you rclone copy a source file from your homedir?

Im running an application (odoo) and as far i understood there are some packages needed for this app to run which are not available anymore in the latest OS. I was looking to upgrade but not sure it will work fine.

I will try to install the rclone from rclone.org directly if no solution...

I did a simple copy using cp command BUT, to make it clear :
Command : rclone copy /home/test.html /test_folder
Output :
2023/09/15 16:55:11 ERROR : test.html: Failed to copy: failed to open source object: open /home/test.html: permission denied
2023/09/15 16:55:11 ERROR : Attempt 1/3 failed with 1 errors and: failed to open source object: open /home/test.html: permission denied

Command : cp /home/test.html /test_folder
Output : empty , when checking with "ls" the file is there.

Is this clear ?

does that work?

I answered this in the previous question or ...?
What do you mean by a source file ?
Sorry but its really confusing..

the source dir you are using is /home and i am asking to test copying a file where ths source is your homedir

rclone touch $HOME/file.ext
rclone copy $HOME/file.ext $HOME/testdir -vv

when you copy, there is a source and dest.
failed to open source object

Odoo runs without any issues on the latest Ubuntu 22.04 LTS. Here example of "how to" install it.

If you keep using out of date OS not maintained for years with even older kernel (also dead for years) with every passing day you will face more and more issues - especially with newer software.

Sometimes there is no choice but then such machine should be left untouched as things can be easily broken beyond repair by installing new stuff. Not even mentioning that it should be as far from Internet as possible:)

1 Like

not really a rclone question but a snapd question.
if you search the internet, should find that snapd might not permit what you want.

at this point, best to download and test rclone, without snap.

Thank you for providing that. For some reason i need to run Odoo8, there is the problem with the packages.
Thanks for advices, i will look it up maybe i can find a way to make it work.

i will uninstall and come back with a clean install.

Thank you!
"I'LL BE BACK " ( joke ) --> terminator :smiley:

no need to uninstall, just download rclone executable and run it.

I already tried this but when running rclone it still uses the one installed with snap, i will remove and get back with new details.

Thx!

should use fullpaths.

root@hetz04:~# which rclone
/snap/bin/rclone
root@hetz04:~# /snap/bin/rclone version
rclone v1.63.1
- os/version: ubuntu 22.04 (64 bit)
- os/kernel: 5.15.0-83-generic (x86_64)
- os/type: linux
- os/arch: amd64
- go/version: go1.20.7
- go/linking: static
- go/tags: none

root@hetz04:~# /root/rclone version
rclone v1.64.0
- os/version: ubuntu 22.04 (64 bit)
- os/kernel: 5.15.0-83-generic (x86_64)
- os/type: linux
- os/arch: amd64
- go/version: go1.21.1
- go/linking: static
- go/tags: none
1 Like

Good news, i installed rclone with the instructions from Install

Worked from the first time. Tested also sync, works also.

Thank you very much for your quick and GREAT support!

Solution : Do not install rclone with snap. Use instructions from Install.

Offtopic : I'm planning to use copy/sync command to copy databases up to 15gb (per file ) using cron jobs , is this a good solution, can you please advise if there is a better solution ? I will need backed up files only in case something bad happens with the vps machine.

that is much discussed in the forum, and internet is full of guides.

There must be a misunderstanding...sorry.
I asked an advice if the workflow im planning to implement is good or not correct. How to implement that etc, i can google it indeed.
Thanks !