Connecting to course account using SSHFS on Windows
Step 1 - Install Cygwin
Download and install the latest version of Cygwin from here:
https://cygwin.com/install.html
Download and open either
setup-x86_64.exe or
setup-x86.exe depending on whether your Windows is 64bit (x86_64) or 32bit (x86). If you aren't sure, right click the Start menu icon, then choose System. The "System Type" will tell you if you're using 64bit or 32bit. In this example, I'm using 64bit:
During the install, you can use the default settings for most of the steps.
On the
Choose A Download Site step, you can just use the first option:
On the
Select Packages step, install these packages:
- procps-ng
- openssh
- libglib2.0_0
To install these packages, change the View to Full. Then search for
procps-ng and set New column to be the latest version. Do this for all 3 packages before clicking Next button.
Step 2 - Install WinFsp
Download and install the latest version of WinFsp from here (download and open the .msi file):
https://github.com/billziss-gh/winfsp/releases
When installing WinFsp, enable the "FUSE for Cygwin" feature:
Step 3 - Install SSHFS-Win
Download and install the latest version of SSHFS-Win from here:
https://github.com/billziss-gh/sshfs-win/releases
Download either the x64 (64bit) or x86 (32bit) .msi file. When installing, you can just use the default settings.
Step 4 - Set up FUSE and SSHFS in Cygwin
Open a Cygwin window (ex. by searching for cygwin in the Windows search bar).
Run the install script that comes with WinFsp. Assuming you installed WinFsp at the default location, you would run this command:
sh '/cygdrive/c/Program Files (x86)/WinFsp/opt/cygfuse/install.sh'
This command should print "FUSE for Cygwin installed":
Next, use the
cp command to create a copy of SSHFS-Win's
sshfs.exe in Cygwin's
/bin folder. If you installed SSHFS-Win at the default location on a 64bit Windows, the command would be:
cp '/cygdrive/c/Program Files/SSHFS-Win/bin/sshfs.exe' /bin
If you installed 32bit version of SSHFS-Win, you may have to use "Program Files (x86)" instead.
Step 5 - Mount accounts
This step will mount your own account and your courses' accounts on the desktop. To make the commands shorter, create a shortcut to the desktop in Cygwin:
ln -s /cygdrive/c/Users/`whoami`/Desktop
Then run this command to mount your own account (replace
yourUserid with your own userid):
sshfs yourUserid@linux.student.cs.uwaterloo.ca: ~/Desktop/yourUserid -ouid=`id -u`,gid=`id -g`
If you're asked if you want to continue, enter "yes". If your password isn't working, try
resetting your password.
If everything is successful, a folder will be created on the desktop that opens your account.
For example, my user ID is yc2lee, so I mount my account like this:
To mount your courses' accounts, run this command for each course (replace
csNNN and
yourUserid):
sshfs csNNN@linux.student.cs.uwaterloo.ca: ~/Desktop/csNNN -ouid=`id -u`,gid=`id -g`,PreferredAuthentications=publickey,IdentityFile=~/Desktop/yourUserid/.ssh/id_rsa
In this example, I'm mounting the cs115ae course account (it's fine if you don't get asked for passphrase):
If you get the error "read: Connection reset by peer," you might not have access to the course account. Same if you see "Password:" and your password doesn't work. Ask your ISC or CSCF for access/help.
You can close the Cygwin window afterwards. The accounts will remain mounted.
To save time, you can copy-paste the sshfs commands you ran into a file (for example, with name
mount-sshfs.sh). Then run
bash mount-sshfs.sh in Cygwin. This way, you won't have to type the commands each time you restart your PC.
Step 6 - Unmounting accounts
If you want to unmount an account, in a Cygwin window, run:
pkill -f 'sshfs.*accountName@'
For example, here I'm unmounting my yc2lee and cs115ae accounts:
If you want to unmount everything mounted with SSHFS, run:
pkill sshfs
Like in Step 5, you can put these pkill commands in files to save typing.