Allowing external access to port 53682 during "config create"

What is the problem you are having with rclone?

I'm using the docker version of rclone. I'm trying to access the oauth link given on the "config create" command outside the host.

By setting --rc-addr 0.0.0.0:5572 in the code bellow, I'm successfuly able to connect to the webui (it doesn't work without that option).

podman run --rm -dt --privileged --name=rclone-e PUID=1000 -e PGID=1000 -p 0.0.0.0:5572:5572 -v /home/me/rclone:/config/rclone docker.io/rclone/rclone:latest rcd --rc-web-gui --rc-addr 0.0.0.0:5572

I'm trying to achieve the same result with the following command:

podman run --rm -dt --name=rclone --privileged -e PUID=1000 -e PGID=1000 -p 0.0.0.0:53682:53682 -v /home/me/rclone:/config/rclone docker.io/rclone/rclone:latest --config /config/rclone/rclone.conf config create remote drive config_is_local false

podman says port is published:

podman port -l
53682/tcp -> 0.0.0.0:53682

Another solution for my usecase would be a command to give the link and return the code (just like when you're manually setting a remote and you choose headless, but I'm not sure if it's possible.

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

rclone v1.57.0

  • os/version: alpine 3.14.2 (64 bit)
  • os/kernel: 5.16.2-arch1-1 (x86_64)
  • os/type: linux
  • os/arch: amd64
  • go/version: go1.17.2
  • go/linking: static
  • go/tags: none

Are you on the latest version of rclone? You can validate by checking the version listed here: Rclone downloads
--> Yes

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

Google Drive

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

podman run --rm -dt --name=rclone --privileged -e PUID=1000 -e PGID=1000 -p 0.0.0.0:53682:53682 -v /home/me/rclone:/config/rclone docker.io/rclone/rclone:latest --config /config/rclone/rclone.conf config create remote drive config_is_local false

The rclone config contents with secrets removed.

Doesn't apply, as I'm trying to make one.

A log from the command with the -vv flag

2022/01/21 18:17:21 DEBUG : rclone: Version "v1.57.0" starting with parameters ["rclone" "--config" "/config/rclone/rclone.conf" "config" "create" "remote" "drive" "config_is_local" "false" "-vv"]
2022/01/21 18:17:21 NOTICE: Config file "/config/rclone/rclone.conf" not found - using defaults
2022/01/21 18:17:21 DEBUG : remote: config in: state="", result=""
2022/01/21 18:17:21 DEBUG : remote: config out: out=&{State:*oauth,teamdrive,, Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
2022/01/21 18:17:21 DEBUG : remote: config in: state="*oauth,teamdrive,,", result=""
2022/01/21 18:17:21 DEBUG : remote: config out: out=&{State:*oauth-confirm,teamdrive,, Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
2022/01/21 18:17:21 DEBUG : remote: config in: state="*oauth-confirm,teamdrive,,", result=""
2022/01/21 18:17:21 DEBUG : Override value found, choosing value "false" for state "*oauth-islocal,teamdrive,,"
2022/01/21 18:17:21 DEBUG : remote: config out: out=&{State:*oauth-islocal,teamdrive,, Option:<nil> OAuth:<nil> Error: Result:false}, err=<nil>
2022/01/21 18:17:21 DEBUG : remote: config in: state="*oauth-islocal,teamdrive,,", result="false"
2022/01/21 18:17:21 DEBUG : remote: config out: out=&{State:*oauth-remote,teamdrive,, Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
2022/01/21 18:17:21 DEBUG : remote: config in: state="*oauth-remote,teamdrive,,", result=""
2022/01/21 18:17:21 DEBUG : Auto confirm is set, choosing default "" for state "*oauth-do,teamdrive,,", override by setting config parameter "config_verification_code"
2022/01/21 18:17:21 DEBUG : remote: config out: out=&{State:*oauth-do,teamdrive,, Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
2022/01/21 18:17:21 DEBUG : remote: config in: state="*oauth-do,teamdrive,,", result=""
2022/01/21 18:17:21 DEBUG : Starting auth server on 127.0.0.1:53682
2022/01/21 18:17:21 NOTICE: If your browser doesn't open automatically go to the following link: http://127.0.0.1:53682/auth?state=XXXXXXXXXXXXXXXXXXXXXXXXXXX
2022/01/21 18:17:21 NOTICE: Log in and authorize rclone for access
2022/01/21 18:17:21 NOTICE: Waiting for code...

I'm not 100% sure on this but I thought for the auth code, it's checking specifically for a URI to come back with on localhost:53682 so if you forward that or do something, I "believe" it won't work.

You could try forwarding it to another port and connect localhost from what you are running. Not sure since there's no rclone version as you skipped that step which gives the OS information so I'm left guessing.

Edited the post with the version.

You could try forwarding it to another port and connect localhost from what you are running. Not sure since there's no rclone version as you skipped that step which gives the OS information so I'm left guessing.

Could you give me an example?

1 Like

I don't use docker, but I'd imagine the same applies as I tested with SSH.

From my local machine, I forward the port to localhost:

ssh -L 53682:localhost:53682 server

and on the server above, I ran the config and on my Mac, I pasted in the auth link it gave me:

2022/01/21 14:02:16 NOTICE: If your browser doesn't open automatically go to the following link: http://127.0.0.1:53682/auth?state=FzgzfX4n7m1kc5mQYT9O9Q

Which in turn on my local browser worked, but lead failed to punch it back into rclone so it didn't work on the last part.

Not sure offhand as I'd authorize it headless and just paste it in.

Not sure if someone with more docker knowledge might pop up.

How could you do that? That'd be another solution.

Just pick the headless option:

Use auto config?
 * Say Y if not sure
 * Say N if you are working on a remote or headless machine

y) Yes (default)
n) No
y/n> n
Option config_verification_code.
Verification code
Go to this URL, authenticate then paste the code here.
https://accounts.google.com/o/oauth2/auth?access_type=offline&client_id=202264815644.apps.googleusercontent.com&redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&response_type=code&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive&state=V2aocvCmdAfxZDM4vyN3aA
Enter a string value. Press Enter for the default ("").
config_verification_code>

and on any machine with a browser, paste that link in log in / paste the code back in the terminal.

On the docker side, you are generating the command in one shot so not sure on docker how to do the same thing.

1 Like

Yes, but how could I select N programatically if there's no flag for it? There's only --auto-confirm. What I'm trying to do is to create a config programatically, with Python.

I think you've hit more @asdffdsa questions as he loves python and loves scripting..

1 Like

Oh! Nvm! I could just pass -it to docker/podman and it becomes interactive. I guess I'll leave this topic without solution for now.

hi,
with gdrive, need to deal with oath and web browser, sure that can be worked around but never tried it, as i do not use google products.
the easy workaround would be to use gdrive service files.

another rcloner had a similar issue about scripting rclone config, might spark some ideas.
in that case, the issue was how to crypt a config file.
that workaround used the linux command expect, python has pyexpect
https://forum.rclone.org/t/possible-to-set-a-password-for-the-rclone-config-file-without-using-rclone-config-2/27703

That's interesting. I'll use that on my code.

Would anyone know if there's a headless mode for config create command. Is there this option? Doc isn't clear.

good, if possible, let's use know how you use my code

headless in what specifc way?

as there already is rclone config create and using the rcd daemon.

Like animosity022 mentioned here.

with python, might try pydrive or some other such project.

I meant passing config_is_local false to config create should prompt for headless or something like that.

just trying to undertand the use-case, to offer a solution.

if you did a headless on one machine, you would still need to goto another machine and use a web browser, correct?

Using the bellow command results in a localhost link and I'm not being able to forward the port to access it.

config create remote drive config_is_local false

if config create config_is_local false could prompt for headless, like in config reconnect (like animosity mentioned), it'd be easier to setup the config programatically. Also, a flag for --auto-deny (in oppose to --auto-confirm) would make it even easier.

I believe the --non-interactive flag does that, but documentation isn't very clear regarding it.

Oh! Yes! passing --result "false" does that:

config create remote drive --continue --state  "*oauth-islocal,teamdrive,," --result "false"

It returned me a json with the headless config link. Now, how could I send the code generated by the link back to rclone?

Found the answer by ncw here: creating new remote with config_is_local=false gives localhost URL · Issue #5825 · rclone/rclone · GitHub

Thank you all, @Animosity022 @asdffdsa, and @ncw, for rclone (alien-level software Wow)

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