UBbox is cloud storage offered by UBIT for all faculty, staff, and students.  CCR does not support UBbox nor do we offer any assistance with using it.  However, we are providing this documentation as a resource to CCR users.  Box does not currently offer a Linux client nor does UBIT support any alternate methods for mounting it.  We have developed and tested a method for mounting UBbox on our servers so CCR users can easily transfer their files between the two services.  


DISCLAIMER: Please realize that since this is unsupported by UBIT we can only do so much to support the service from our end.  If you have any problems with your UBbox account or settings, you will need to contact UBIT, not CCR.

However, if you have any problems with the scripts mentioned below, please submit a CCR help ticket.



NOTE: The UBbox storage (which is provided by box.com), has some limitations:







You will only be able to mount UBbox from CCR's data transfer node: transfer.ccr.buffalo.edu.

The first time you want to mount UBbox, you will need to do some setup (see steps 1 through 5)

This setup process allocates an API ticket for the mount, which will expire (only) if you do not access the mount for 60 days, in which event you will have to go through the setup process again.




1. Login to CCR's transfer server:  transfer.ccr.buffalo.edu


    Instructions for logging into CCR resources can be found in this knowledgebase article

    Login to transfer also requires uploading you ssh keys through our IDM portal as per this knowledgebase article



2.  Run the script ub-box-mount-setup and follow the instructions


[ccruser@srv-m15-37 ~]$ ub-box-mount-setup



The output will be similar to:



You will have to set up an ssh tunnel to complete the configuration

This is a one time configuration requirement and is not needed subsequently
for the UB Box mount

Open an ssh tunnel from port 53682 on your host to
port 53682 on transfer.ccr.buffalo.edu

For example:

$ ssh -x4fnNL 53682:localhost:53682 username@transfer.ccr.buffalo.edu

then open your brower, when instructed, to:
  http://127.0.0.1:53682/auth


2018/11/28 15:39:46 NOTICE: Config file
"/user/username/.config/rclone/rclone.conf" not found - using defaults
Remote config
If your browser doesn't open automatically go to the following link:
http://127.0.0.1:53682/auth
Log in and authorize rclone for access
Waiting for code...




3.  Following the notes displayed in the output above, open an ssh tunnel

     from your local host port 53682 to tansfer port 53682, for example:


your_host$ ssh -x4fnNL 53682:localhost:53682 username@transfer.ccr.buffalo.edu

[...]

your_host$ 


Windows users - instructions for setting up a SSH tunnel using MobaXterm can be found here




4. On you local host, open a web browser to:


    http://127.0.0.1:53682/auth


    Login to grant access to Box:

username: _ub_username_@buffalo.edu

password: _ub_password_



The UB shibbolith login will appear if you have not already authenticated to UB

username: _ub_username_

password: _ub_password_


[Sign In]




    Then the browser window will display:


With access to your _username_@buffalo.edu Box account, rclone can:

Read and write all files and folders stored in Box


[Grant access to Box]


    After you press [Grant access to Box] the browser window will display:


Success!

All done. Please go back to rclone.

you can now close this browser window.



Back on your transfer login session the output should be similar to:


Got code
Paste the following into your remote machine --->
{"access_token":"[...]","token_type":"bearer","refresh_token":"[...],"expiry":"2019-[...]:00"}
<---End paste--------------------
[ub-box]
type = box
config_automatic = yes
token =
{"access_token":"[...]","token_type":"bearer","refresh_token":"[...]","expiry":"2019-[...]:00"}
--------------------

You can now disconnect the ssh tunnel on your host
e.g.

$ kill $(ps -efwww | egrep '[s]sh.*53682:localhost:53682' | awk '{print $2}')


[ccruser@srv-m15-37 ~]$ 



5.  You can now disconnect the ssh tunnel on your local host, e.g.


your_host$ kill $(ps -efwww | egrep '[s]sh.*53682:localhost:53682' | awk '{print $2}')
your_host$ 



6.  Mount UBbox

[ccruser@srv-m15-37 ~]$ mount-ub-box

[ccruser@srv-m15-37 ~]$ ls ~/UB-Box/


Now copy files to or from UBbox to or from your CCR home directory, group project directory, or /gpfs/scratch



7. To Un-mount UBbox - this is optional.

    You can leave it mounted and the mount will persist through logouts


[ccruser@srv-m15-37 ~]$ umount-ub-box  



After the first time setting this up, you only need to do step 6 and, optionally, step 7, when you want to access UBbox from the CCR transfer node.



IMPORTANT POINT: The UB-Box directory will remain in your home directory even if you don't have UBbox mounted on the transfer node.  It will also appear in your home directory on other CCR servers that do not mount UBbox.  The directory will appear empty.  You will not be able to access UBbox from any nodes or servers other than the data transfer node.  It will not be accessible from within a SLURM job.