Using rclone to pull data from Dropbox

21 December 2019

rclone can be used to access many remote storage providers from the shell, even on platforms which may not be supported by the native clients of such provider. A platform which is supported is required to do the authorisation shenanigans however.

The use case here is that I wanted access directly to my Dropbox on my FreeBSD server, and Dropbox is not supported on FreeBSD.

The below steps set this out:

Note: I refer to rclone v1.48.0 on FreeBSD 12.0-RELEASE-p9

  1. On FreeBSD

    pkg install rclone
    rclone config

    Answer the qs until it gets to the authorisation part and if it asks if you want to autoconfigure, hit ‘n’—as I am assuming the server is headless and therefore cannot run a graphical browser. If it can you can just hit ‘y’ in which case the below steps 2/3/4 are not needed.

  2. Then on OSX

    brew install rclone
    rclone authorize "dropbox"
  3. It will print an access token like this

    2019/12/21 20:07:11 NOTICE: Config file "/Users/mike/.config/rclone/rclone.conf" not found - using defaults
    If your browser doesn't open automatically go to the following link: http://127.0.0.1:53682/auth?state=[...]
    Log in and authorize rclone for access
    Waiting for code...
    Got code
    Paste the following into your remote machine --->
    {"access_token":"[...]","token_type":"bearer","expiry":"0001-01-01T00:00:00Z"}
    <---End paste
  4. Paste in the JSON with the token on the FreeBSD machine

  5. When you’re done you can test with

    rclone listremotes

    and it should show up.

To list all the directories on the remote source for instance (note my remote is called dbox here)

rclone lsd dbox:

rclone --help will give a full list of commands

rclone is a truly fantastic piece of software — I was able to download c. 30gb of data from my dropbox to my FreeBSD in about 10 minutes. Hats off to the team at rclone.org