Back to Index

Some time last year, UNSW introduced a server for VSCode SSH, a setting in VSCode which allows users to control a remotely running instance of VSCode. Recently, more and more students have taken to using it. Since the server has to essentially host that many instances of VSCode, it quickly grinds to a halt whenever many students are using it (which, like with most of CSE's infrastructure, is usually when it's needed most).

Using plain SSH is a more viable alternative for students. The servers still get slow if there are lots of users, but SSH is usually more lightweight, and CSE has more servers decided to SSH access.

The trouble arises when using a newer IDE/Editor such as VSCode. SSH is fine for remote sessions with tmux and vim, but the servers struggle to run graphical applications, and manually SCP-ing files back and forth is a nuisance.

I had been meaning to try using an SSH/SCP-based file system with the CSE servers, and recently I did. In particular, I tried out SSHFS. The results are very good, admittedly I can't compare them first hand to VSCode SSH, but having seen my students use VSCode SSH I can safely say it's more reliable and faster.

This approach won't give you the same consistency as VSCode SSH (for example, you won't get the same extensions), but I rarely see students using it other than to edit remote files and run remote commands.

Setting up SSHFS

SSHFS can be installed very easily on Debian-flavour distributions:

$ sudo apt install sshfs

Installing on MacOS, Windows or other Linux distributions is very possible, although outside the scope for this guide. There are plenty of other guides online which will cover this.

Once SSHFS is installed, you'll then need to find the full path of your CSE home folder (it won't just be /home/(zID). You can do this by quickly SSH'ing into CSE and running pwd. In my case, I get this:

$ ssh z555[email protected]
(SSH banner)
$ pwd

Once you have your home folder's full path, you can then mount that somewhere on your system. First set up your mount point, for this guide I'm choosing cse:

$ mkdir -p cse

Finally, to actually mount your home folder:

$ sshfs -o idmap=user [email protected]:/import/cage/2/z5555555 cse

You'll need to replace the home path with your home path you obtained earlier. idmap=user maps the UID and GID of the remote user (that is, your CSE user) to the UID and GID of the local user (that is, your local account). Without this the files are mapped to your CSE UID, which has no meaning on your local computer.

Now you can cd into your mounted CSE files, open up VSCode locally, and connect to SSH in the VSCode termial. This gives you effectively the same experience as VSCode SSH, but with better performance and with a whopping three remote servers to use.

You can un-mount your remote files at any time:

$ fusermount3 -u cse

I also recommend setting up a small shell script to mount your files, and setting up SSH keys so that you don't need to always enter your password every time.