Skip to content

Instantly share code, notes, and snippets.

@floitsch
Created July 24, 2025 10:10
Show Gist options
  • Select an option

  • Save floitsch/1aee727238cafc94ed12bf824ff07fa1 to your computer and use it in GitHub Desktop.

Select an option

Save floitsch/1aee727238cafc94ed12bf824ff07fa1 to your computer and use it in GitHub Desktop.
#!/bin/sh
# from https://github.com/rom1v/rsshfs/blob/master/rsshfs
# from https://hg.slitaz.org/wok/rev/c2a6bbd5b24f
rhost="${2%%:*}"
rpath="${2#*:}"
lpath="$1"
case "$1" in
-u) ssh "$rhost" fusermount -u "$rpath"
;;
''|-*) cat <<EOT
usage:
$0 localpath remotehost:remotepath [-o ro -o allow_other]
$0 -u remotehost:remotepath
EOT
;;
*) fifo=/tmp/rsshfs-fifo$$
shift 2
mkfifo $fifo
/usr/sbin/sftp-server < $fifo | \
ssh "$rhost" sshfs -o slave ":$lpath" "$rpath" "$@" > $fifo
rm -f $fifo
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment