Mount mc2 as a folder on your local computer

Windows users

SSH Filesystem (SSHFS) uses the SSH protocol to mount a remote filesystem over SSH on a local machine. In order to use SSHFS on Microsoft Windows we are going to use SSHFS-Win which is an SSHFS port to Windows.

In order to use SSHFS on Windows we need to install the following packages:

  1. WinFsp - This is a tool that allows developers and software engineers to to write their own file systems (Windows drives) as user mode programs and without Windows kernel programming knowledge.

  2. SSHFS-Win - This is a port of SSHFS to Windows. SSHFS-Win uses Cygwin and WinFsp.

  3. SSHFS-Win Manager - This is a GUI (graphics user interface) for SSHFS on Windows based on SSHFS-Win.

Start by launching a Powershell terminal window and install WinFsp:

C:\> winget install -e --id "WinFsp.WinFsp"

Next install sshfs-win:

C:\> winget install -e --id "SSHFS-Win.SSHFS-Win"

And finally install the lattest version of SSHFS-Win Manager. In this case you should download the installer from this link, and execute the file.

Open the application SSHFS-Win Manager, where you will be presented with a screen like the following:

SSHFS-Win Manager: Adding a new connection

Press the button "Add Connection", which will result in the opening of another window, where you can setup the connection to mc2.

SSHFS-Win Manager: Configuring a new connection

Fill in the blanks with:

  • Name: mc2
  • IP/Host: either enter the IP address of mc2 (193.137.172.90), or its FQDN (mc2.ua.pt).
  • Port: The SSH connection port (default is 22).
  • User: Your user name on mc2.
  • Authentication method: Choose "Private Key (file)".
  • Key file: Use the file browser to navigate into the directory C:\Users\<localuser>\.ssh\ (where <localuser> is your Windows username) and select the private key file generated above.
  • Remote path: This is the path on mc2 to be mounted on your local computer. Chose /home/<username>, where <username> is you username in mc2.
  • Local drive letter: This is a drive letter on your computer which will host the remote folder.

Click on the "ADVANCED" tab, turn on the "custom command line params" button, and add the following options:

  • idmap=user
  • create_file_umask=0111
  • create_dir_umask=0000

Finally, save the configuration, "plug-in" the connection, enjoy!

Linux/macOS users

Installing SSHFS on Linux/macOS is a relatively straightforward process. There are plenty of web resources explaining the procedure in great detail.

Mac users have to install macFUSE and then SSHFS. They can both be downloaded from here. It is suggested to follow the instructions from this link.

Linux users simply have to use their app manager to install the sshfs package. For Ubuntu for instance:

[user@client]$ sudo apt install sshfs

For Red Hat Enterprise Linux based installations (Fedora, Rocky, ...) you should enter:

[user@client]$ sudo dnf install sshfs

A great tutorial for a Linux installation of sshfs is available here.

After installing SSHFS you can mount your mc2 home space on your personal macOS/linux box. Start my creating a folder where the remote filesystem is to be mounted on:

mkdir $HOME/Remote/mc2

Now issue the command below, minding that you should replace <username> with your username in mc2, and making sure that you have entered the correct path for the private key (IdentityFile parameter):

[user@client]$ sshfs -o default_permissions,allow_symlinks,reconnect,volname="mc2",IdentityFile=$HOME/.ssh/id_ed25519_mylaptop mc2.ua.pt:/home/<username> $HOME/Remote/mc2

MacOS users are advised to add noappledouble to the above option list. This will disable the creation of ._* double files during file transfers.

You can now use your favorite file browser to explore your files in mc2 from your local PC.

Should you wish to unmount the remote filesystem, simply enter:

[user@client]$ umount $HOME/Remote/mc2

Finally, consider creating a shell script to execute the above commands, or even setting up a permanent mount in /etc/fstab.