Serving Google Drive to Web Browser

What is the problem you are having with rclone?

I would like to use Google Drive as a Photo repository to serve images on my website.

What is your rclone version (output from rclone version)

v1.57.0

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

Google Drive

Good Day

As stated in my heading above, i would like to serve images like the following example - https://canadianheadstones.ca/photos/Rock-Chapel-church.jpg

If I mount the Google Drive with rclone using the mount folder example - https://canadianheadstones.ca/web_im/Rock-Chapel-church.jpg

I get the following error - Forbidden
You don't have permission to access this resource.

Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.

I do believe this is a permission issue and have researched --allow-other and I am trying to understand mount scopes - drive.readonly.

Could someone point me in the right direction to resolve this issue? If Google Drive doesn't work for this, i can change to another option. Just looking for a solution to offload some images from my server.

Thanks

Steve Fulton, UE

Not sure as you have not shared a mount command, a serve command or a log.

Other than seeing you have an error, how would you suggest we help?

You deleted parts of the help and support template as need them :frowning:

Hi there

I apoligize as i did not think it would be helpful. The mount command is below but how do i manage the permissions using this?

rclone mount --vfs-cache-mode full web_files:website_photos \web_im

Thanks
Steve

Since you didn't post the output of rclone version, I didn't know what OS you are running so I can't answer that either. It depends if you are running Windows or Linux on that answer.

Hi there

Here is the output of the Version:

rclone v1.57.0

  • os/version: centos 7.9.2009 (64 bit)
  • os/kernel: 3.10.0-1160.6.1.el7.x86_64 (x86_64)
  • os/type: linux
  • os/arch: amd64
  • go/version: go1.17.2
  • go/linking: static
  • go/tags: none

Steve

How are you serving it?
Is it the same user as is running the mount?

So I am going to say no. I have installed Rclone on a VPS Webserver and have activated the mount using one of the organizations Google Email Accounts to connect to the Google Drive.

When running a fuse mount on Linux, for any other user on the box to access the mount, you have to use --allow-other. This allows users other than the one running rclone to see the content in the moment.

So start simple, validate you can see the file as the user running rclone.
Add in the -allow-other flag and validate the user running your web server or however you are serving it can see the files.
Finally, test on the browser.

Feels like a bunch of steps as you can bypass that with just using rclone serve http and you don't need to use a mount at all.

rclone serve http

Thanks and I will try this and let you know
Steve

Good Evening - I fiqured i would send this before shutting down for the night. I went with your opinion and used rclone serve http - This is the command i used:

rclone serve http --http-no-head --addr :8080 web_files:website_photos

I went to a URL which should have served the image and it appears to be looking for it but then times out. - https://canadianheadstones.ca:8080/web_files/website_photos/Rock-Chapel-church.jpg

Any thoughts?

Thanks

Steve

Run it with -vv and share the full output.

Here is the output:

[ch@ontar318 ~]$ rclone serve http --http-no-head -vv --addr :8080 web_files:website_photos&
[1] 14698
[ch@ontar318 ~]$ 2021/12/23 04:53:19 DEBUG : rclone: Version "v1.57.0" starting with parameters ["rclone" "serve" "http" "--http-no-head" "-vv" "--addr" ":8080" "web_files:website_photos"]
2021/12/23 04:53:19 DEBUG : Creating backend with remote "web_files:website_photos"
2021/12/23 04:53:19 DEBUG : Using config file from "/home/ch/.config/rclone/rclone.conf"
2021/12/23 04:53:19 DEBUG : Google drive root 'website_photos': 'root_folder_id = 0AM0NpRiGFpwqUk9PVA' - save this in the config to speed up startup
2021/12/23 04:54:19 INFO :
Transferred: 0 B / 0 B, -, 0 B/s, ETA -
Elapsed time: 1m0.5s

2021/12/23 04:54:19 DEBUG : Google drive root 'website_photos': Checking for changes on remote
2021/12/23 04:55:19 INFO :
Transferred: 0 B / 0 B, -, 0 B/s, ETA -
Elapsed time: 2m0.5s

2021/12/23 04:55:19 DEBUG : Google drive root 'website_photos': Checking for changes on remote
2021/12/23 04:56:19 INFO :
Transferred: 0 B / 0 B, -, 0 B/s, ETA -
Elapsed time: 3m0.5s

2021/12/23 04:56:19 DEBUG : Google drive root 'website_photos': Checking for changes on remote
2021/12/23 04:57:19 INFO :
Transferred: 0 B / 0 B, -, 0 B/s, ETA -
Elapsed time: 4m0.5s

2021/12/23 04:57:19 DEBUG : Google drive root 'website_photos': Checking for changes on remote
2021/12/23 04:58:19 INFO :
Transferred: 0 B / 0 B, -, 0 B/s, ETA -
Elapsed time: 5m0.5s

2021/12/23 04:58:19 DEBUG : Google drive root 'website_photos': Checking for changes on remote
2021/12/23 04:59:19 INFO :
Transferred: 0 B / 0 B, -, 0 B/s, ETA -
Elapsed time: 6m0.5s

2021/12/23 04:59:19 DEBUG : Google drive root 'website_photos': Checking for changes on remote
2021/12/23 05:00:19 INFO :
Transferred: 0 B / 0 B, -, 0 B/s, ETA -
Elapsed time: 7m0.5s

2021/12/23 05:00:19 DEBUG : Google drive root 'website_photos': Checking for changes on remote
2021/12/23 05:01:19 INFO :
Transferred: 0 B / 0 B, -, 0 B/s, ETA -
Elapsed time: 8m0.5s

2021/12/23 05:01:19 DEBUG : Google drive root 'website_photos': Checking for changes on remote
2021/12/23 05:02:19 INFO :
Transferred: 0 B / 0 B, -, 0 B/s, ETA -
Elapsed time: 9m0.5s

2021/12/23 05:02:19 DEBUG : Google drive root 'website_photos': Checking for changes on remote
2021/12/23 05:03:19 INFO :
Transferred: 0 B / 0 B, -, 0 B/s, ETA -
Elapsed time: 10m0.5s

2021/12/23 05:03:19 DEBUG : Google drive root 'website_photos': Checking for changes on remote
2021/12/23 05:03:19 DEBUG : web_files: Loaded invalid token from config file - ignoring
2021/12/23 05:03:19 DEBUG : Saving config "token" in section "web_files" of the config file
2021/12/23 05:03:19 DEBUG : web_files: Saved new token in config file
2021/12/23 05:04:19 INFO :
Transferred: 0 B / 0 B, -, 0 B/s, ETA -
Elapsed time: 11m0.5s

2021/12/23 05:04:19 DEBUG : Google drive root 'website_photos': Checking for changes on remote
2021/12/23 05:05:19 INFO :
Transferred: 0 B / 0 B, -, 0 B/s, ETA -
Elapsed time: 12m0.5s

2021/12/23 05:05:19 DEBUG : Google drive root 'website_photos': Checking for changes on remote
2021/12/23 05:06:19 INFO :
Transferred: 0 B / 0 B, -, 0 B/s, ETA -
Elapsed time: 13m0.5s

2021/12/23 05:06:19 DEBUG : Google drive root 'website_photos': Checking for changes on remote
2021/12/23 05:07:19 INFO :
Transferred: 0 B / 0 B, -, 0 B/s, ETA -
Elapsed time: 14m0.5s

2021/12/23 05:07:19 DEBUG : Google drive root 'website_photos': Checking for changes on remote
2021/12/23 05:08:19 INFO :
Transferred: 0 B / 0 B, -, 0 B/s, ETA -
Elapsed time: 15m0.5s

2021/12/23 05:08:19 DEBUG : Google drive root 'website_photos': Checking for changes on remote
2021/12/23 05:09:19 INFO :
Transferred: 0 B / 0 B, -, 0 B/s, ETA -
Elapsed time: 16m0.5s

2021/12/23 05:09:19 DEBUG : Google drive root 'website_photos': Checking for changes on remote
2021/12/23 05:10:19 INFO :
Transferred: 0 B / 0 B, -, 0 B/s, ETA -
Elapsed time: 17m0.5s

2021/12/23 05:10:19 DEBUG : Google drive root 'website_photos': Checking for changes on remote
2021/12/23 05:11:19 INFO :
Transferred: 0 B / 0 B, -, 0 B/s, ETA -
Elapsed time: 18m0.5s

2021/12/23 05:11:19 DEBUG : Google drive root 'website_photos': Checking for changes on remote
2021/12/23 05:12:19 INFO :
Transferred: 0 B / 0 B, -, 0 B/s, ETA -
Elapsed time: 19m0.5s

This checking of the Google Drive for Changes do not stop. Please note this folder has thousands of images.

Thanks

Steve

So, i decided to close the terminal and kill the process and try the command agian

rclone serve http -v --http-no-head --addr :8080 web_files:website_photos&

First i got this: [1] 19143

Then a minute later:

[ch@ontar318 ~]$ 2021/12/23 05:17:04 INFO :
Transferred: 0 B / 0 B, -, 0 B/s, ETA -
Elapsed time: 1m0.4s

[ch@ontar318 ~]$ 2021/12/23 05:18:04 INFO :
Transferred: 0 B / 0 B, -, 0 B/s, ETA -
Elapsed time: 2m0.4s

It now continues every minute

Steve

There's no hit on the website for anything though so nothing actually hit that page to serve something from the logs.

Firewall/something else blocking it?

You can put three backtics around a log file

like
this

To share a log.

Morning

It would help if i opened Port 8080 on the Firewall. Now that is open, i have to work though the process of making it secure - https

When i made it temporary http, it simply came back as file not found. I know the file is in the directory. It is just not seeing it

Steve

I can't see your screen either so if you test something, you have to share a log if you want some feedback.

Got it to work. The Images are now showing. I am going to work though my commands and put the solution here for reference for others in the next few days.

Thanks agian

Steve Fulton, UE

hi,

rclone serve http, imho, would never expose that to the big, bad interent and millions of hackers.

play it safe and use a real webserver, such as nginx or apache.

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