rclone with Dropbox
Overview
Section titled “Overview”rclone is a command-line tool for syncing, copying, and managing files on cloud storage. It works well as a replacement for the Dropbox desktop client on Linux servers, and handles large transfers more reliably than tools like dropbox-uploader.
This page covers setting up rclone with Dropbox on a lab server. Because the server has no browser, authentication requires a brief SSH tunnel from your local machine.
Note — Before reading
Please be aware of the following placeholder terms:
Placeholder Meaning USERNAMEyour ZLab username HOSTNAMEhostname of server REMOTE_NAMEthe name you choose for your rclone remote (e.g. dropbox)
Prerequisites
Section titled “Prerequisites”- rclone installed on the server (check with
rclone version) - SSH access to the server configured per the getting started guide
Caution: The commands in this tutorial assume your
~/.ssh/configis set up exactly as described in the getting started guide. Without it, the SSH tunnel command will not work as written.
Step 1: Open the SSH Tunnel
Section titled “Step 1: Open the SSH Tunnel”OAuth authentication requires rclone to briefly communicate with a local web browser. Since the server is headless, you need to forward the auth port to your local machine first.
First, open an SSH connection to the server in a new terminal on your local machine:
ssh USERNAME@HOSTNAMENote: This connects directly to
HOSTNAMEwithout manually stepping through the bastion server —~/.ssh/confighandles the proxy hop transparently. This is also what makes the tunnel command work correctly.
Then, in a second new terminal on your local machine, open the tunnel:
ssh -N -L localhost:53682:localhost:53682 USERNAME@HOSTNAME| Command | Description |
|---|---|
ssh | The secure shell program that creates encrypted connections |
-N | Flag that means “don’t execute a remote command/shell” — just forward ports |
-L localhost:53682:localhost:53682 | Forward port 53682 on the server to port 53682 on your local machine |
USERNAME@HOSTNAME | Your username and the server to connect to |
Note: No output is expected — silence means the tunnel is working. The terminal will remain held until you close it. If you see an error, double-check your
~/.ssh/configagainst the getting started guide.
Leave both terminals running while you complete the next step. You can close the tunnel terminal once configuration is done.
Step 2: Configure the Remote
Section titled “Step 2: Configure the Remote”In your first terminal (the SSH session on the server), run:
rclone configFollow the prompts as shown below.
Create a new remote:
No remotes found - make a new onen) New remotes) Set configuration passwordq) Quit confign/s/q> nName your remote. You can use any name — dropbox is a reasonable choice if you only have one Dropbox account. You will use this name in all subsequent rclone commands (referred to as REMOTE_NAME on this page).
name> REMOTE_NAMESelect Dropbox as the storage type. A long list of storage providers will be printed — enter dropbox to select Dropbox.
Storage> dropboxLeave the App ID fields blank to use rclone’s default shared App ID, which is fine for lab use:
** See help for dropbox backend at: https://rclone.org/dropbox/ **
OAuth Client IdLeave blank normally.Enter a string value. Press Enter for the default ("").client_id>
OAuth Client SecretLeave blank normally.Enter a string value. Press Enter for the default ("").client_secret>Skip advanced config:
Edit advanced config? (y/n)y) Yesn) No (default)y/n> nChoose auto config (this is what uses the SSH tunnel you opened in Step 1):
Use auto config? * Say Y if not sure * Say N if you are working on a remote or headless machiney) Yes (default)n) Noy/n> yrclone will print a URL and wait:
If your browser doesn't open automatically go to the following link:http://127.0.0.1:53682/auth?state=XXXXXXXXXXXLog in and authorize rclone for accessWaiting for code...Open that URL in your local machine’s browser. Log in to Dropbox and authorize rclone. The tunnel forwards the callback back to the server automatically.
Once authorized, the terminal will show:
Got code--------------------[REMOTE_NAME]token = {"access_token":"...","token_type":"bearer","expiry":"0001-01-01T00:00:00Z"}--------------------y) Yes this is OK (default)e) Edit this remoted) Delete this remotey/e/d> yConfirm with y, then quit the config:
e/n/d/r/c/s/q> qYou can now close the SSH tunnel terminal.
Basic Usage
Section titled “Basic Usage”Note: The
:afterREMOTE_NAMEis required in all rclone commands — it tells rclone you are referring to a remote, not a local path.
# List top-level folders in your Dropboxrclone lsd REMOTE_NAME:
# List all files in your Dropbox (can be verbose)rclone ls REMOTE_NAME:
# List a specific folderrclone ls REMOTE_NAME:my-folder
# Copy a local file or folder to Dropboxrclone copy /local/path REMOTE_NAME:remote/path
# Copy from Dropbox to localrclone copy REMOTE_NAME:remote/path /local/path
# Sync a local folder to Dropbox (one-way mirror — deletes on destination)rclone sync /local/path REMOTE_NAME:remote/pathCaution:
rclone syncdeletes files at the destination that are not present at the source. Userclone copyif you want a one-way transfer without deletions.
More Information
Section titled “More Information”rclone copyandrclone synchave help entries with more options:rclone copy --helpandrclone sync --help- The
-Pflag (--progress) prints live transfer progress to the terminal, which is useful for large transfers
- The
- rclone Dropbox documentation (or you can run command
rclone help backend dropboxon the server for backend-specific help)
- Shared folders owned by others cannot be accessed via rclone with a personal token — this is a Dropbox API limitation. Only folders owned by your own Dropbox account are accessible.
- App ID: rclone uses a shared App ID by default, which is sufficient for most lab use. If you need your own (e.g., for rate limit reasons), see the rclone Dropbox “Get your own App ID”.