Mounting a remote directory over SSH integrates remote storage into the local filesystem, enabling file operations with standard tools while traffic remains encrypted. Using SSHFS, remote paths appear as part of the local directory tree, which simplifies editing, synchronisation, and backups across different systems.

The SSHFS client is a FUSE-based filesystem that talks to the remote host using the SFTP subsystem of OpenSSH. After authentication, file operations such as open, read, and write on the mount point are translated into SFTP requests on the selected remote directory, subject to the permissions of the remote user account.

Stable operation depends on working SSH connectivity, correct ownership and permissions on the remote directory, and appropriate authentication method. For automatic mounting at boot using /etc/fstab, passwordless authentication and network availability are essential; incorrect entries or unreachable hosts can delay startup or block mounting until the issues are resolved.

Steps to mount a remote filesystem with SSHFS:

  1. Open a terminal on the local Linux system.
  2. Install SSHFS on the local Ubuntu or Debian system.
    $ sudo apt update && sudo apt install --assume-yes sshfs
    Hit:1 http://ports.ubuntu.com/ubuntu-ports noble InRelease
    Get:2 http://ports.ubuntu.com/ubuntu-ports noble-updates InRelease [126 kB]
    Get:3 http://ports.ubuntu.com/ubuntu-ports noble-backports InRelease [126 kB]
    Get:4 http://ports.ubuntu.com/ubuntu-ports noble-security InRelease [126 kB]
    Get:5 http://ports.ubuntu.com/ubuntu-ports noble-updates/main arm64 Packages [1,781 kB]
    Get:6 http://ports.ubuntu.com/ubuntu-ports noble-updates/main arm64 Components [172 kB]
    Get:7 http://ports.ubuntu.com/ubuntu-ports noble-updates/restricted arm64 Components [212 B]
    Get:8 http://ports.ubuntu.com/ubuntu-ports noble-updates/universe arm64 Packages [1,467 kB]
    Get:9 http://ports.ubuntu.com/ubuntu-ports noble-updates/universe arm64 Components [376 kB]
    Get:10 http://ports.ubuntu.com/ubuntu-ports noble-updates/multiverse arm64 Components [212 B]
    Get:11 http://ports.ubuntu.com/ubuntu-ports noble-backports/main arm64 Components [3,576 B]
    Get:12 http://ports.ubuntu.com/ubuntu-ports noble-backports/restricted arm64 Components [216 B]
    Get:13 http://ports.ubuntu.com/ubuntu-ports noble-backports/universe arm64 Components [10.5 kB]
    Get:14 http://ports.ubuntu.com/ubuntu-ports noble-backports/multiverse arm64 Components [212 B]
    Get:15 http://ports.ubuntu.com/ubuntu-ports noble-security/main arm64 Components [18.4 kB]
    Get:16 http://ports.ubuntu.com/ubuntu-ports noble-security/restricted arm64 Components [212 B]
    Get:17 http://ports.ubuntu.com/ubuntu-ports noble-security/universe arm64 Components [71.4 kB]
    Get:18 http://ports.ubuntu.com/ubuntu-ports noble-security/multiverse arm64 Components [208 B]
    Fetched 4,280 kB in 4s (982 kB/s)
    Reading package lists...
    Building dependency tree...
    Reading state information...
    10 packages can be upgraded. Run 'apt list --upgradable' to see them.
    Reading package lists...
    Building dependency tree...
    Reading state information...
    The following NEW packages will be installed:
      sshfs
    0 upgraded, 1 newly installed, 0 to remove and 10 not upgraded.
    Need to get 45.2 kB of archives.
    After this operation, 170 kB of additional disk space will be used.
    Get:1 http://ports.ubuntu.com/ubuntu-ports noble/universe arm64 sshfs arm64 3.7.3-1.1build3 [45.2 kB]
    Fetched 45.2 kB in 1s (53.6 kB/s)
    Selecting previously unselected package sshfs.
    (Reading database ... 
    (Reading database ... 5%
    (Reading database ... 10%
    (Reading database ... 15%
    (Reading database ... 20%
    (Reading database ... 25%
    (Reading database ... 30%
    (Reading database ... 35%
    (Reading database ... 40%
    (Reading database ... 45%
    (Reading database ... 50%
    (Reading database ... 55%
    (Reading database ... 60%
    (Reading database ... 65%
    (Reading database ... 70%
    (Reading database ... 75%
    (Reading database ... 80%
    (Reading database ... 85%
    (Reading database ... 90%
    (Reading database ... 95%
    (Reading database ... 100%
    (Reading database ... 272033 files and directories currently installed.)
    Preparing to unpack .../sshfs_3.7.3-1.1build3_arm64.deb ...
    Unpacking sshfs (3.7.3-1.1build3) ...
    Setting up sshfs (3.7.3-1.1build3) ...
    Processing triggers for man-db (2.12.0-4build2) ...

    On CentOS or Red Hat, install the fuse-sshfs package instead.

    $ sudo dnf --enablerepo=PowerTools --assumeyes install fuse-sshfs
  3. Verify that password-based SSH access to the remote host functions correctly.
    $ ssh user@host.example.net hostname
    host

    Ensure the remote account used for SSHFS has full read or write access to the directory selected for mounting.

  4. Create a local directory to serve as the mount point for the remote filesystem.
    $ mkdir -p /home/user/remote
  5. Mount the remote directory manually using SSHFS.
    $ sshfs user@host.example.net:/home/user/remotefolder /home/user/remote
  6. Confirm that the mount is present in the filesystem table output.
    $ df -h /home/user/remote
    Filesystem                                     Size  Used Avail Use% Mounted on
    user@host.example.net:/home/user/remotefolder   62G   11G   48G  19% /home/user/remote
  7. Create a test file inside the mount point to validate read and write access.
    $ touch /home/user/remote/file.txt
  8. Unmount the SSHFS filesystem when access is no longer required.
    $ fusermount -u /home/user/remote

    The fusermount command unmounts FUSE filesystems owned by the current user without requiring elevated privileges.

  9. Confirm that the unmount removed the remote entry from the filesystem table.
    $ df -h /
    Filesystem      Size  Used Avail Use% Mounted on
    /dev/sda2        62G   11G   48G  19% /
  10. Open /etc/fstab with a preferred text editor to prepare automatic mounting at system startup.
    localuser@localhost:~$ sudo vi /etc/fstab

    Automatic SSHFS mounting requires passwordless SSH for the specified user, and incorrect entries in /etc/fstab can cause boot delays or prevent mounting until corrected.

  11. Add an SSHFS entry to /etc/fstab pointing to the remote directory and local mount point.
    sshfs#user@host.example.net:/home/user/remotefolder /home/user/remote fuse user,_netdev,reconnect,uid=1000,gid=1000,idmap=user 0 0

    Use the id command to obtain the appropriate uid and gid values.

    $ id
    uid=1000(user) gid=1000(user) groups=1000(user),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),100(users),114(lpadmin)
  12. Trigger mounting via /etc/fstab to ensure the configuration is valid.
    $ sudo mount /home/user/remote
  13. Verify that the remote filesystem appears again in the mounted filesystems list.
    $ df -h /home/user/remote
    Filesystem                                     Size  Used Avail Use% Mounted on
    user@host.example.net:/home/user/remotefolder   62G   11G   48G  19% /home/user/remote