diff --git a/scripts/rsshfs b/scripts/rsshfs new file mode 100755 index 0000000..7b0760d --- /dev/null +++ b/scripts/rsshfs @@ -0,0 +1,17 @@ +#!/bin/sh + +# reversed sshfs - mount a local directory on a host + +ssh="$(dirname "$(readlink "$(command -v ssh)")")/.." +host=$(echo "$2" | sed 's/\(.*\):.*/\1/') +mount=$(echo "$2" | sed 's/.*:\(.*\)/\1/') +path=$1 +shift 2 + +pipe=$(mktemp -u) +mkfifo "$pipe" +exec 3<>"$pipe" +rm "$pipe" + +"$ssh/libexec/sftp-server" <&3 | +ssh "$host" sshfs ":$path" "$mount" -o passive "$@" >&3