Quick Remote File Access

This post appeared originally in our sysadvent series and has been moved here following the discontinuation of the sysadvent microsite

Sometimes it is be nice to mount a path from a remote file system as if it was local. Setting up NFS or Samba may be a lot of hassle, and may require root access on one or both of the boxes. Enter FUSE and SSHFS.

FUSE makes it possible to implement a file-system in a user-space program. Lots of such programs exists, making it possible to access web sites, blogs, your android, google drive, your google mail and lots more as if it was local file systems - all without root. There is an incomplete list on Sourceforge.

For quick access of a remote file system, there is SSHFS. It’s very simple to use:

## Install sshfs
$ sudo pacman -S sshfs ||
    sudo apt-get install sshfs ||
    sudo yum install sshfs ||
    sudo opkg -i sshfs ||
    sudo zypper install sshfs ||
    sudo my_fancy_package_manager install sshfs

## create a mount-dir and mount
$ mkdir my.box.at.bekkenstenveien53c.oslo.no
$ sshfs my.box.at.bekkenstenveien53c.oslo.no: my.box.at.bekkenstenveien53c.oslo.no/

## access those files
$ ls my.box.at.bekkenstenveien53c.oslo.no/
...
$ mplayer $(find my.box.at.bekkenstenveien53c.oslo.no/ -name *.mp3)
...

## unmount
$ fusermount -u my.box.at.bekkenstenveien53c.oslo.no

Of course SSHFS doesn’t fit all needs:

  • Performance: the mplayer command above didn’t work out to well for me (with too slow bandwidth out of that house, too many files and directories in that home directory on that box, etc … and finally the file names contained spaces).
  • Permissions: This is most useful when you have typical “user applications” that needs access to files on the home directory. You’d have to SSH in as root to get full access to the remote file system, and only your local user on the local box will have access to the files:
$ sudo ls ~/my.box.at.bekkenstenveien53c.oslo.no/
ls: cannot access /home/tobias/my.box.at.bekkenstenveien53c.oslo.no/: Permission denied
  • Stability and persistence: You would typically use this for a one-off job, if you require a mount that can come up automatically on boot and persist network problems, etc, then SSHFS is probably not the right tool.
  • SSHFS may not always be available, i.e. it does not exist in the official SailfishOS repositories.

The official web pages of SSHFS is also found on Sourceforge.

Tobias Brox

Senior Systems Consultant at Redpill Linpro

Tobias started working as a developer when he finished his degree at The University of Tromsø. He joined Redpill Linpro as a system administrator a decade ago, and have embraced working with our customers, and maintaining/improving our internal tools.

Att bana väg för öppen källkod i offentlig sektor

Open source i offentlig sektor - utmaningar, möjligheter och vägen framåt.

Summering

Denna artikel beskriver processen och lärdomarna från att släppa ett API som öppen källkod inom offentlig sektor. Projektet, som utvecklades för digitala nationella prov (“DNP”), visar hur öppen källkod kan stärka samarbete, transparens och innovation. Artikeln lyfter fram både möjligheter och utmaningar – från säkerhet och juridiska aspekter till kulturellt motstånd – och ger insikter för andra myndigheter som överväger liknande initiativ.

Slutsatsen är att öppen källkod ... [continue reading]

Why automate Ansible

Published on January 14, 2025

Comparison of different compression tools

Published on December 18, 2024