brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: sshfs mounts a remote folder over SSH like a local drive

Network and access
~/tips/tip-linux-sshfs-mount-remote-folder

sshfs user@server:/srv/data ~/remote

Mounts a directory from another machine on a local folder, using nothing more than an SSH login.

When you only need to open files from another machine now and then, setting up Samba or NFS is overkill. If you can SSH to it, you can mount it.

mkdir -p ~/remote
sshfs user@server:/srv/data ~/remote
fusermount -u ~/remote

The syntax in the README is sshfs [user@]hostname:[directory] mountpoint. If you leave out the directory, you get the remote home folder. After the mount, a file manager, an editor or cp work on the files as if they were local, and the data travels through the SSH connection. The last line above unmounts on Linux. The README says to use umount on BSD and macOS.

Extra SSH options can be passed with -o, for example -o port=2222. The sftp and ssh_config manual pages list the rest.

The caveat is what you need. sshfs works through FUSE, so FUSE has to be installed and your user needs permission to use it. On Linux that is usually one package. On macOS you need to install a FUSE implementation first, and which one works depends on your macOS version, so check the documentation of the one you choose. The README also says the project has no active regular contributors, with only high-impact issues getting attention. A network drop can leave a hanging mount, which you clear with the unmount command.

Further reading: GitHub: libfuse/sshfs, OpenBSD manual: ssh

More Network and access tips scp -3 alice@server-a:/var/backups/db.sql.gz bob@server-b:/srv/restore/ tailscale exit-node suggest tailscale lock sign nodekey:1abddef1 tlpub:abcdef12 wg genpsk > peer1.psk Table = off All Network and access tips (163) All topics

Link