print friendly version

How to...

Accessing Box files on linux using rclone


Installing rclone

 

To obtain the latest version of rclone, use the rclone installation script by entering the following command in a terminal window:

 

$ curl https://rclone.org/install.sh | sudo bash

 

Alternative installation instructions are available from the rclone website: https://rclone.org/install/

 

Configuration for use with Box

 

To access Box files using rclone, you will need to configure an rclone remote.
A remote can be thought of as a named local configuration of a remote file store (the information required to access Box in this case).

1. Run the  rclone config  command in a terminal using the command

rclone config


When presented with the config menu (shown below) press the  n  key followed by  Enter

Config menu

 

2. Provide a name for the new remote, this will be how you uniquely identify the remotes that you have configured. Below we’ve used the name  Box  but this can be anything you like

Name your remote

 

3. Next you need to select the type of online account that rclone will be accessing. When prompted, either type  box  or enter the number that corresponds to the box online storage in the output list of available options

Select type 

 

4. Leave the next 3 steps blank (default) by pressing  Enter  for each of them

 

5. When prompted, enter  user  as the account type

User as account type

 

6. Unless you’re already familiar with rclone and require some advanced configuration, enter   n  for the advanced config prompt option

Advanced config

 

7. You can allow rclone to automatically configure the remote by entering  y  for the Remote config prompt

Auto config

 

8. A new tab will appear in your web browser window and present the Box login screen. Select the “Use Single Sign On (SSO)” link beneath the login form. If the browser tab isn’t automatically opened, a link is provided in the terminal

SSO

 

9. Enter your university email address in the form of username@sussex.ac.uk and then “Authorize”

Authorize

 

 

10. Choose “Grant access to Box” to allow the rclone client installed on your computer to access to your Box files

Grant access

 

Once authorised, a success message will appear in the browser window

Success

 

11. Back in the terminal, information about the account will appear along with the confirmation prompt to complete setting up the remote. Press  y  to confirm.

Confirm prompt

 

12. An overview of your current remotes now includes the newly created Box remote, from here, exit the configuration menu by pressing  q

 

Overview

Now the remote has been configured there are several commands available which are analogous to common linux command line programs such as  rclone ls ,   rclone touch ,  rclone rmdir  – a full list can be found using   rclone help  or documentation available on the rclone website.

 

Mounting remotes to access files in your file browser

 

A remote can be mounted locally using the rclone mount command as shown below which requires an empty directory to exist to use as the mount point. The “--vfs-cache-mode writes" option enables local caching of files for writing, without this option some files, such as .docx and .xslx files, won’t be writeable.

 

$ mkdir –p ~/Documents/Box

$ rclone mount --daemon --vfs-cache-mode writes Box:/ ~/Documents/Box/

 

Once mounted, you should now find the remote mounted within your file browser to allow for GUI interaction with your Box files.

To unmount:

 

$ fusermount -u ~/Documents/Box

 

Automatically mounting box files on system startup

 

You can automate the mounting of our Box files upon login by adding the following lines to the  ~/.profile  file:

 

if ! mountpoint -q ${HOME}/Documents/Box

then

    /usr/bin/mkdir -p ${HOME}/Documents/Box

    /usr/bin/rclone mount \

    --allow-non-empty \

    --config=${HOME}/.config/rclone/rclone.conf \

    --daemon \

    --vfs-cache-mode writes \

    Box:/ ${HOME}/Documents/Box

fi

 

created on 2020-06-22 by Alexander Butler
last updated on 2020-06-22 by Alexander Butler