Accessing Remote Files via a GUI

Suhas Somnath
Advanced Data and Workflows Group
National Center for Computational Sciences
Oak Ridge National Laboratory

12/8/2017

In certain cases, we may be interested in operating on files present on a remote machine. One useful example is when we want to visualize images (assuming that we have not used X forwarding) or use some other software to open / manipulate a file that is present on the local machine but not on the remote machine. We can operate on the remote files just as easily as we operate on local files using a convenient tool called sshfs.

This guide was adapted from DigitalOcean.com

You will need to download and install some software before accessing your files: - Follow the instructions in the above link to install the necessary packages. - For example, MacOS users will need to visit OSXFuse and install FUSE followed by SSHFS.

Once the necessary software is installed, you can put together a simple bash script to establish the connection between your local and remote computers. The shell script below defines a few variables pertaining to the locations that will need to be changed depending on the situation: - localdir - absolute path for a folder on your local computer. Set this to a folder where you would like the remote directory to be mounted. Do NOT set this to a folder already containing some files. - remotedir - absolute path of the desired folder on the remote machine that you want to manipulate on your local / personal computer. - remote_address - user_name@IP_address_of_remote_machine.

Modify ONLY the first three lines of this script and leave the last two lines as is

localdir=/Users/userid/Desktop/empty_directory
remotedir=/home/userid/my_project/my_remote_folder
remote_address=userid@ip_address_of_remote_machine
mkdir $localdir
sudo sshfs -o allow_other,defer_permissions $remote_address:$remotedir $localdir

This does not automatically mount the remote folder on your local machine just yet. In order to do this, run this bash script via the Terminal application as:

$ bash fuse_script

You will be prompted to enter the password of your local machine and then the remote machine in the terminal window. Once the credentials are accepted, the folder specified as localdir will be turned into a mount volume (it may look like an external thumb drive).

You may now open this volume to operate on the files on the remote machine's folder.

Once you are done working on your files, you can eject this volume and delete the temporary local folder.