Using Box on Linux
This is a short post to detail what I found is currently the best way, at least for me, to use Box on Linux.
I use Box mostly as a backup for various data, which I access once in a while.
Unfortunately, Linux seems to be very low priority for Box and
the WebDAV interface has been deprecated,
which leaves Linux users in pretty bad shape.
For my use case, the best I found for now to access Box is to use rclone
.
It works for both personal and enterprise accounts, and provides a way to easily manage and sync files. It also provides a mount
command, which can be used to mount a remote
directory as a FUSE filesystem.
To setup rclone
for Box, the first step is to create a Box application.
For this, login into your Box account and click on “Dev Console” in the left menu.
Then, create a new app, which should be a “Custom App” using “Standard OAuth 2.0”
authentication. The name of the app is not important, as it will never be shown to anyone except you.
Once the app is created, go to the app configuration and set the “Redirect URI”
to “http://127.0.0.1:53682/”. Keep the page open as the information will be needed
to configure rclone
.
The next step is to actually configure rclone
.
Run rclone config
and follow the instructions:
- Choose “New remote” (
n
) - Choose a name for the remote, preferably short, as you will be typing it quite often
- Choose “Box” (
box
) - Copy/paste the client ID from the Box application webpage
- Copy/paste the client secret from the Box application webpage
- Configure the advanced config if needed, otherwise press
n
- Use auto config (
y
) - Press the “Grant access to box” in your browser
- Confirm the remote (
y
) - Exit the config (
q
)
This should be enough to get rclone
working with Box.
You can check then check rclone
documentation or rclone
man page for more information
about what you can do.
Here some sample commands take from the tldr
pages.
-
List contents of a directory on an rclone remote:
rclone lsf remote_name:path/to/directory
-
Copy file or directory from local source to remote destination:
rclone copy path/to/source_file_or_directory remote_name:path/to/destination_directory
-
Copy file or directory from remote source to local destination:
rclone copy remote_name:path/to/source_file_or_directory path/to/destination_directory
-
Sync local source to remote destination, changing the destination only:
rclone sync path/to/file_or_directory remote_name:path/to/directory
-
Move file or directory from local source to remote destination:
rclone move path/to/file_or_directory remote_name:path/to/directory
-
Delete remote file or directory (use
--dry-run
to test, remove it to actually delete):rclone --dry-run delete remote_name:path/to/file_or_directory
-
Mount rclone remote (experimental):
rclone mount remote_name:path/to/directory path/to/mount_point
-
Unmount rclone remote if CTRL-C fails (experimental):
fusermount -u path/to/mount_point