Linux HOWTOs

About | Home | Search


HOWTO: sshfs
Description: SSH Filesystem
Click here for ChangeLog
NOTE: I use GNU tar >= 1.13.25 so it's -j for .tar.bz2 files,
it's safe to assume that make, gcc, binutils, fileutils/coreutils, gawk, sed, and grep are prerequisites for almost everything


# SSHFS 3.5.0
# ===========
# Prerequisites:
# Ninja
# Python 3.x (for Meson and to test it)
# FUSE >= 3.1.0
# pkg-config

# Become root to install a few things with pip3
# Meson
# docutils
# Create symlink from docutils' rst2man.py to rst2man
# pytest
su
pip3 install --upgrade meson
pip3 install --upgrade docutils
test ! -e /usr/bin/rst2man && ln -s /usr/bin/rst2man.py /usr/bin/rst2man
pip3 install --upgrade pytest
exit


# Get it
cd
test -f installed/sshfs-3.5.0.tar.xz &&
 mv installed/sshfs-3.5.0.tar.xz .
test ! -f sshfs-3.5.0.tar.xz &&
 wget https://github.com/libfuse/sshfs/releases/download/sshfs-3.5.0/\
sshfs-3.5.0.tar.xz

# Verify tarball w/ sha256sum:
# (this came from my gpg-verified tarball)
echo "c2035332489dea3be88b9328d0e1905f904a34f93eb87fb07cd5380329a3df\
e5  sshfs-3.5.0.tar.xz" | sha256sum -c

# Verify tarball w/ gpg:
( gpg --list-keys 3C4E599F > /dev/null 2>&1 || gpg --recv-keys 3C4E599F ) &&
 wget -nc https://github.com/libfuse/sshfs/releases/download/sshfs-3.5.0/\
sshfs-3.5.0.tar.xz.asc &&
  gpg --verify sshfs-3.5.0.tar.xz.asc &&
   rm sshfs-3.5.0.tar.xz.asc

# Extract the source
mkdir -p -m 0700 ~/src
cd ~/src
find -maxdepth 1 -type d -name "sshfs-*" -exec rm -r {} \;
tar xJvf ~/sshfs-3.5.0.tar.xz
cd sshfs-3.5.0
test $UID = 0 && chown -R root:root .

# Slackware's aaa_elflibs package includes a libfuse in /lib.  If you
# install a new libfuse from source and you left it in /usr/lib*/, you may
# need to remove the presumably older one in /lib.  If it links with the
# older one, you may get a complaint when running sshfs like this:
# fuse: warning: library too old, some operations may not not work

# Read ./README.rst and https://github.com/libfuse/sshfs/wiki

# Create a build directory
mkdir build
cd build

# Make it a Meson build directory
meson setup .. .

# List configuration options, if you need to change anything
# It should already know to use lib64 if 64-bit
meson configure

# Change some options
meson configure -Dprefix=/usr -Dinfodir=info -Dmandir=man -Dsysconfdir=/etc

# Build it
ninja

# Become root to test and install it
su

# Install it
ninja install

# Read 'man sshfs'

# Example use, mounting /home/jason on remote server "bleh" as local
# directory /home/jason/foo, all run as the user 'jason'.
# Create the local mount point directory (/home/jason/foo):
#   mkdir ~/foo
# Mount the remote filesystem to that created local directory:
#   sshfs bleh: ~/foo
# Unmount it when finished:
#   fusermount3 -u ~/foo
# or
#   umount ~/foo

# Become yourself again
exit

# Save the source for later
cd
mkdir -p -m 0700 installed
rm -f installed/sshfs-*.tar.*
mv sshfs-3.5.0.tar.xz installed/


# If you ever want to uninstall SSHFS, this should do it:
cd
su
test -d src/sshfs-fuse-* && ( cd src/sshfs-fuse-* ; make uninstall )
test -d src/sshfs-* &&
 ( cd src/sshfs-*
   make uninstall
   test -d build && cd build && ninja uninstall )
for pfx in /usr /usr/local;
do
  rm -f ${pfx}/bin/sshfs ${pfx}/man/man1/sshfs.1 \
   ${pfx}/sbin/mount.fuse.sshfs ${pfx}/sbin/mount.sshfs
done
exit
find ~/src -maxdepth 1 -type d -name "sshfs-*" -exec rm -r {} \;
rm -f ~/installed/sshfs-*.tar.*

Back to the list


Last updated: Tue, 07 Aug 2018 12:06:17 -0400
Jason Englander <jason at englanders dot us>