Accessing UCSF Box

It is possible to access UCSF Box using FTP over a secure SSL connection (FTPS). The below instructions works from the Wynton HPC data-transfer nodes as well as your local computer.

Prerequisites

In order to do access UCSF Box as describe below, you need to:

Accessing UCSF Box over FTPS

With a UCSF Box-specific password (see above), you can use, for instance, the lftp or curl tools to access to your UCSF Box account. Start by logging in to one of the data-transfer nodes, either directly from outside or via a login node, e.g.

[alice@wynlog2 ~]$ ssh dt2
alice1@dt2:s password: XXXXXXXXXXXXXXXXXXX
[alice@dt2 ~]$ 

Then, verify that your UCSF Box setup is correct, but logging into the root of your UCSF Box folder using your UCSF Box-specific password (not your Wynton HPC password):

[alice@dt2 ~]$ lftp --user alice.aliceson@ucsf.edu ftps://ftp.box.com
Password: XXXXXXXX  <== UCSF Box password here!
lftp alice.aliceson@ucsf.edu@ftp.box.com:~> ls
drwx------  1 owner group     0 Jun 12  2014 Grant_R01.pdf
drwx------  1 owner group     0 Sep 30  2016 Secure-alice.aliceson@ucsf.edu
lftp alice.aliceson@ucsf.edu@ftp.box.com:~> exit
[alice@dt2 ~]$ 

Automatic authentication

When starting lftp as above, you need to manually enter your password, which can be tedious or even prevent automatic file transfers in batch scripts. A solution to this is to set up the FTPS credentials in ~/.netrc. Here is what it could look like:

[alice@dt2 ~]$ cat ~/.netrc
machine ftp.box.com
	login alice.aliceson@ucsf.edu
	password AliceSecretPwd2017

Since the password is fully visible in plain text, make sure to keep this file private at all times, otherwise users on the system can see all your credentials, i.e.

[alice@dt2 ~]$ chmod 600 ~/.netrc
[alice@dt2 ~]$ ls -l ~/.netrc 
-rw------- 1 alice alice 72 Jul  3 15:10 /home/alice/.netrc

To verify that the automatic authentication works, try to log in again. You should no longer be prompted for your password - instead lftp gets it automatically from ~/.netrc. For example:

[alice@dt2 ~]$ lftp --user alice.aliceson@ucsf.edu ftps://ftp.box.com
lftp alice.aliceson@ucsf.edu@ftp.box.com:~> ls
drwx------  1 owner group     0 Jun 12  2014 Grant_R01.pdf
drwx------  1 owner group     0 Sep 30  2016 Secure-alice.aliceson@ucsf.edu
lftp alice.aliceson@ucsf.edu@ftp.box.com:~> exit
$ 

Note that curl also recognizes ~/.netrc credentials, e.g.

[alice@dt2 ~]$ curl --netrc -O ftps://ftp.box.com/Grant_R01.pdf
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 15.6M  100 15.6M    0     0  1561k      0  0:00:10  0:00:10 --:--:-- 3918k
[alice@dt2 ~]$ ls -la Grant_R01.pdf
-rw-r--r-- 1 alice cluster 16453180 Jul 10 21:13 Grant_R01.pdf