Child pages
  • Using Box under Linux
Skip to end of metadata
Go to start of metadata

Before you will be able to use FTPS/lftp with your IU Box account, you must first create an external password. See the KB page Creating and using an external password for Enterprise Box for instructions.

As of March 1st, 2019 IU Box no longer supports WebDAV or DAVFS protocols so the documention about these options has been removed from this page.  These protocols may or may not work with the commercial box.com offering.  Box announced they would  be disabling WebDAV access on Jan 31, 2019 so any WebDAV-based access was scheduled to stop working at that time.  However, then subsequently announced that the demise of WebDAV support was delayed.


Many people are using Box.com Cloud Storage and taking advantage of the benefits of the IU Box Service. Even though there is no Box Sync or Box Drive for the Linux platform, it can still be used effectively via HTTPS, FTPS clients (like lftp), and rclone as explained in this page.

HTTPS Access

You can access your IU Box account using the link for the IU Box Service. Using this url provides the convenience and security of CAS and single sign-on with your IU Network ID. While the web interface may not be ideal for all applications, it does give you access to your account as well as the ability to preview, upload, and download files.  There is no Box Edit available for Linux so that functionality is not available.  However, the Box for Office Online features are supported which provides an extremely convenient way to create, edit, and share Word, Excel, and Powerpoint files directly from a browser.

FTPS (lftp)

Please note that you should never use the standard FTP protocol with ftp.box.com since your login credentials will be transferred across the network in clear text.  IU Box will fail if you attempt an unencrypted FTP connections but even a failed FTP login attempt will send your credentials in cleartext so you want to be sure never to use the FTP protocol.

The lftp command is a powerful file transfer client that can be used with Box.  Box supports the secure FTPS protocol and you can use this with lftp for secure file transfer and mirroring.  Here is an example of how to connect using FTPS.  The lftp command is smart enough to auto-negotiate to use FTPS but this example forces the issue to make absolutely sure unencrypted FTP is never attempted.

$ lftp
lftp :~> set ftps:initial-prot ""
lftp :~> set ftp:ssl-force true
lftp :~> set ftp:ssl-protect-data true
lftp :~> open ftps://ftp.box.com:990
lftp ftp.box.com:~> user username@indiana.edu
Password: 
lftp username@indiana.edu@ftp.box.com:~> ls
...

Note that you must use an external password and not your normal IU passphrase per the note at the top of this page.  Once you are connected, you can use normal FTP commands like ls, get, put, etc.

One interesting application of lftp with Box is using it to mirror a local directory similar to what Box Sync does, albeit in a more manual way.  The best way to explain this is by example so here is a sample script that mirrors a local /u/username/MyProject directory to Box into a folder of the same name (MyProject):

#!/bin/bash
lftp -c 'open -e "set ftps:initial-prot ""; \
   set ftp:ssl-force true; \
   set ftp:ssl-protect-data true; \
   open ftps://ftp.box.com:990; \
   user username@indiana.edu; \
   mirror --reverse --delete --no-perms --verbose "/u/username/MyProject" MyProject;" '

When you run this script, it will prompt for a password and then mirror your local directory to Box.  Each time you run it, it will re-sync any changes on the local filesystem with the copy on Box.  The --verbose option causes lftp to tell you exactly what it is doing.  If you are doing this via crontab, you probably want to remove that and you will also need to pass along the password in the script so do that with caution.

Note that when using this method, you may have it fail with this message:

Login failed: 530 Box: CAPTCHA is required. Please log into www.box.com in a web browser, and then try again.

If that happens, just go to https://box.iu.edu/ and log in using your IU SSO credentials.

Rclone

Rclone is a command line program used to sync files and directories to and from a variety of service providers, including Box.  See the Rclone Box page for more information about setting up and using Rclone with Box.  The basic steps to get started are:

  1. Run "rclone config".  Note that rclone is already installed on all of our unified Linux systems but it may need to be installed on other systems.
  2. If you don't have an rclone configuration file then it will be created at this time.  The first decision you need to make is whether you want to s) Set configuration password and you should give this a lot of thought.  This config step will create a configuration file (~/.config/rclone/rclone.conf) that includes an access token used to access your Box account and all the files in it.  You are strongly encouraged to use a configuration password that is sufficiently secure but different from your IU Passphrase.  By doing this, you will need to use this password each time you run rclone to unlock your configuration file, thereby giving access to your access token (and, by inference, your Box account and all the files you have in the account).  If you do not set a configuration password then if your configuration file is compromised then anyone with access to that file can access your Box account and all the files in it.  For this reason, you are strongly encouraged to use this feature.  The one downside of using a configuration password is that it prevents passwordless access via things like cron jobs and the like.  Also note that the access token in the configuration file will become invalid if not used for 60 days.
  3. Select the option for n) New remote and give the remote a descriptive name like "iubox".  You should avoid using a remote name with spaces.
  4. Enter box as the storage type
  5. Just hit enter (twice) to leave the Client Id and Secret blank
  6. Say No to edit advanced config
  7. Say Yes to use the auto config and you will be taken to a Box login in your browser.  At this point, you have two options for logging in.  You can log in using your normal IU account and IU Passphrase or you can use an external Box account password (see the note at the top of this page).  In most cases, you will just want to use your normal IU email and passphrase but using the external account will also work.
  8. In the browser acknowledge that you are giving rclone access and then return to the rclone configuration and accept the authentication token when prompted.
  9. Once this is complete, just q) Quit config and then you can use rclone.

Once you have things set up, you can use rclone to do various file operations like listing files and uploading/downloading files.  As a first test you can run "rclone lsd iubox:" to verify that things are working properly (replace iubox in this command with whatever name you used for the remote config).  If this is all working properly, then you should get a listing of everything you have in your Box account.  See the rclone documentation (including the complete list of commands) for more information.

rclone sync

One useful feature of rclone is the sync functionality which is similar to Box Sync.  This allows you to keep local copies of files from a Box folder on your local system and keep them in sync with the copies on Box.  See the documentation for rclone sync for more details.  If you want to use this feature on the SICE Unified Linux systems, please submit a service request and we can create a local directory on your workstation for this purpose.  Your home directory is mounted from the central file server and we do not recommend using a directory within your home directory as the destination of the rclone sync.  You have limited disk quota in your home directory and it is slower than a local filesystem so we can help you with access to the local disk space on your workstation for this purpose.

rclone mount

One of the more interesting features of rclone is the ability to mount your Box space so it is accessible via the filesystem which is similar to Box Drive.  See the documentation in the rclone mount page for more information about this option.  If you want to use this feature on the SICE Unified Linux systems, please submit a service request and we can create a local mount point on your workstation for this purpose.  Your home directory is mounted from the central file server and we do not recommend using a directory within your home directory as the rclone mount point.  So, for example, if we create a directory on your local system named /home/janedoe/box then you can use rclone to mount and unmount your Box SomeProject directory as follows:

Mount:   rclone mount iubox:SomeProject /home/janedoe/box
Umount:  fusermount -u /home/janedoe/box

Please note that this is not 100% seamless so see the Limitations section of the rclone mount page for come caveats and tips.  If you run into problem you may have better luck using the “--vfs-cache-mode writes” or “--vfs-cache-mode full” options as noted in that page.  You can use the rclone sync feature instead to give yourself local copies of a directory that you can work on which is more akin to the functionality of Box Sync.