Connecting to UCLA’s SEASnet servers using SSHFS
The short version
- Install a filesystem in userspace kernel extension
- Install SSHFS
sshfs <ssh-target>:<remote-folder> <mountpoint> [options]
<ssh-target> = something like
<remote-folder> = folder on the SEASnet server (
<mountpoint> = your local mountpoint (
[options] = whatever you want (
The long version
Recently, there was a question asked in the UCLA CS Facebook group by Hakan Kimeiga that interested me. You can see it here:
There were a lotta interesting comments on the post, you can check out the full post, comments and all, here.
But one really interested me, from Cody Ley Han:
!! Mounting the SEASnet files directly to my computer means that I’d be able to edit my SEASnet OCaml files using all the pretty syntax highlighting that sublime supplies! I need that. I NEED that.
There were a few steps that I needed to go through in order to make this happen.
First, I had to download a kernel extension that allowed me to have file systems in user space (you don’t have to worry about what this means until after you take CS 111).
Now that I had a FUSE API, (which lets developers play around with file system APIs), I could download and use SSHFS. (a program that plays around with file systems)… Nice!! With fresh installs of OSXFUSE and SSHFS, I was ready to mount the SEASnet server’s files to my computer.
Basically, mounting file (
foo.img) from a physical disk to a file (
/mnt/foo) on your computer says: “Read the bytes at this file (
foo.img), and interpret them as a specific data structure. Display the information we’ve gathered from these bytes at (
a file system is just a large and meticulous data structure
- Aside: If you type
mountinto your shell, then you’ll see a list of all the disks you’ve mounted. If your computer has any storage, then you’ll have at least one disk mounted.
- Aside: You can mount both physical devices, and virtual devices. Virtual devices? I meant disk images. Disk images? I meant files that’re made up of binary data, structured corresponding to a file system. (
- Aside: SSHFS actually mounts a remote-ssh’able-folder instead of a file. But you can bet that it packages everything up in a nice little data structure to send over the network
Anyway, back to actually mounting the file system! Now that I had all the power and capability to connect, I needed to figure out exactly what I wanted. I didn’t wanna mount
/from the SEASnet servers, because then I’d have to click through all those folders to get to my files. I wanted to mount the virtual disk
/u/cs/ugrad/ari/Classes. Y’all will wanna mount something else.
And I wanted to mount those files to somewhere that I could open easily – I wanted my mountpoint easily accessible. I made the folder
~/Desktop/mnt for this purpose.
Probably don’t mount directly to your Desktop, or else you’ll hide all of your Desktop’s files whilst the SEASnet server is still mounted. And that’ll look really strange. It’s okay, though, because you can undo your mistake by just unmounting the disk that you mounted to your desktop. One of many ways to unmount a disk is by using the
umount <mountpoint> or
umount <host>:<remote-folder> both work. Remember, you can figure out your disk’s mountpoint by using the
And boom! We can access remote SEASnet files as if they were stored directly on a folder on my desktop. The options I used to mount my server are:
You can find what each of those tags do by reading the sshfs man page.
The script below is the simplest version that worked.
#!/bin/bash#mt-lnxsrv – a script that helps me mount over sshfsHOST="ucla"
FLAGS="-o auto_cache,reconnect,defer_permissions,noappledouble,volname=lnxsrv"#get the script `connected` from my github, or omit this line
if ! connected lnxsrv.seas.ucla.edu; then echo "bad"; fiprintf "\tMounting"
sshfs $HOST:$REMOTE_FOLDER $MOUNTPOINT $FLAGS
Go to my GitHub for the actual scripts and aliases I use to make mounting easy. My newer scripts are a lot better 😁
I hope you enjoyed the read! I want to get better at writing technical guides. If the pacing was off, or something else was bad, please tell me how I can improve.