Failed to load config file, permission denied

What is the problem you are having with rclone?

I have tried to solve this for many days now without any solution.
I have an ubuntu installation and run rclone within a bash script that is called from nginx server and the $USER is www-data user just before calling the rclone command. The rclone configuration file and the rclone log file both has these "permissions". What have I done wrong?

patrik@patrikserver:~$ ls -ltr /home/patrik/.config/rclone/rclone.conf
-rwxrwxrwx 1 www-data www-data 453 Oct 30 13:27 /home/patrik/.config/rclone/rclone.conf

patrik@patrikserver:~$ ls -ltr /tmp/rclone.log
-rw-r----- 1 www-data www-data 2112 Nov 1 08:03 /tmp/rclone.log

What is your rclone version (output from rclone version)

rclone v1.53.2

  • os/arch: linux/amd64
  • go version: go1.15.3

Which OS you are using and how many bits (eg Windows 7, 64 bit)

Ubuntu 20.04

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

google photos

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

/usr/bin/rclone -vv --config=/home/patrik/.config/rclone/rclone.conf --log-file=/tmp/rclone.log copy /var/www/html/recordings/test.flv googlePhotoMalung:album/malungVideos

The rclone config contents with secrets removed.

[googlePhotoMalung]
type = google photos
read_only = false
token = {}

A log from the command with the -vv flag

2020/11/01 08:13:12 DEBUG : rclone: Version "v1.53.2" starting with parameters ["/usr/bin/rclone" "-vv" "--config=/home/patrik/.config/rclone/rclone.conf" "--log-file=/tmp/rclone.log" "copy" "/var/www/html/recordings/test.flv" "googlePhotoMalung:album/malungVideos"]
2020/11/01 08:13:12 DEBUG : Creating backend with remote "/var/www/html/recordings/test.flv"
2020/11/01 08:13:12 Failed to load config file "/home/patrik/.config/rclone/rclone.conf": open /home/patrik/.config/rclone/rclone.conf: permission denied

What user is running the program?

You'd need permission from the error as it's probably higher up as you need to ls -al as the user running the program and validate if it works.

The user is www-data

Have this in the bash script that calls rclone:
dest="/var/www/html/recordings/test.flv"
mv $1 $dest
jag="$(whoami)"
echo "$jag" >> /tmp/temp.log
echo "$1" >> /tmp/temp.log
echo "$dest" >> /tmp/temp.log
ls -ltr $dest >> /tmp/temp.log
/usr/bin/rclone -vv --config=/home/patrik/.config/rclone/rclone.conf --log-file=/tmp/rclone.log copy $dest googlePhotoMalung:album/malungVideos

The temp.log then looks like this:
www-data
/var/www/html/recordings/malung-1604252855.flv
/var/www/html/recordings/test.flv
-rw-r--r-- 1 www-data www-data 4003477 Nov 1 17:47 /var/www/html/recordings/test.flv

/Patrik

As that user, try to cat the config file.

I finally did it like in

sudo -i # log in as root
su - www-data -s /bin/bash

As the config command then wanted to store the config under /var/www which was denied due to root ownership i just pasted the output to another file under /var/www/html/rclone/rclone.conf where both directory and file was owned by www-data.
I still don't understand though why it did not work to have the same rclone/rclone.conf under /home/patrik/.config with the owner/permissions. Probably some error by me :slight_smile:

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