Skip to content

This document is a WORK IN PROGRESS.
This is just a quick personal cheat sheet: treat its contents with caution!


SSHFS

SSHFS is a FUSE based file system client for mounting remote directories over a Secure Shell connection.

Reference(s)

Table of contents


Table of contents


Install

A correct kernel config is needed:

$ cd /usr/src/linux
$ sudo make nconfig # or `$ sudo make menuconfig`

    # Activate Btrfs in the kernel
    # Double check here: <https://wiki.gentoo.org/wiki/SSHFS#Kernel>
    #
    > File systems  ->
    >     [*] FUSE (Filesystem in Userspace) support

Warning

After configuring the kernel don't forget to do a kernel make and rebuild!

$ sudo emerge -a net-fs/sshfs
$ sudo pacman -S sshfs
$ sudo apt install sshfs
$ sudo yum install sshfs
$ sudo dnf install sshfs

Config

You may want to restrict a specific user to a specific directory on the remote system. This can be done by editing /etc/ssh/sshd_config:

$ sudo vi /etc/ssh/sshd_config
    > ...
    > Match User someuser
    >        ChrootDirectory /chroot/%u
    >        ForceCommand internal-sftp
    >        AllowTcpForwarding no
    >        X11Forwarding no
    > ...


Use

  • Mount remote folder via SSHFS:

    $ sshfs [user@]host:[/path/to/remote/folder] /path/to/mountpoint [options]
    

  • Unmount:

    $ fusermount3 -u /path/to/mountpoint
    


If this cheat sheet has been useful to you, then please consider leaving a star here.