Last updated: August 2025

SSHFS

Secure Shell File System

Note: This article series covers configuring Debian 12 for hosting multiple domains and web sites on a single dedicated server. As such, some strategies may be inappropriate for your environment. Sockets for example are appropriate for communication between services hosted on the same machine but not suited to a set up with distributed services (where you'd use ports). Please consult the overview for more information.


Operating System: Debian 12
SSHFS: version 3.7.3, FUSE library 3.14.0, using FUSE kernel interface 7.31, fusermount3 3.14.0

Once you've got your drives set up you'll want to transfer files to and from your server.

You can do this with FTP or sFTP but I like to use SSHFS, another acronym that stands for Secure Shell File System. Basically, it allows you to mount your server file system like any other drive in your operating system, so you can view and edit files just like on any other drive.

I like to set up a shortcut for mounting the drive (so it's not mounted all day and I don't accidentally delete or add files to it when I'm doing something else).

I use Ubuntu, so here's how I go about setting it up on that operating system. Update your package manager to make sure you get the latest version:

sudo apt update

Then install it:

sudo apt install sshfs

Now make a new script which will automate mounting your server as a drive. Obviously, use your server IP address and SSH details (use -i if you want to use a custom certificate - see the secure login article for more info!), it creates a mount point in your home folder called 'server' so just be aware of that because you don't want to accidentally copy or delete files from that location once mounted:

nano ~/mount_server.sh

#!/bin/bash

echo "Mounting server (< your IP address > ) to ~/server in 5 seconds (ctrl-c to cancel)..."
sleep 5
mkdir -p ~/server
sshfs -p 2222 < your user >@< your IP address >:/ ~/server
Make your new script executable:

chmod +x ~/mount_server.sh

Add an alias to .bashrc (all Linux platforms) or .bash_aliases (Ubuntu) so you can run your script quickly from the command line:

nano .bash_aliases

alias mt="~/mount_server.sh"
You'll have to end your current terminal session and run a new command line to pick up your new alias.

Now when you want to access your server drive quickly, just enter mt into a terminal and it'll appear in your file browser (Nautilus for Ubuntu) and you can also access it through the ~/server mount point.

Simple!



2025