scripts/rsshfs: add script for reverse sshfs
This commit is contained in:
parent
6572a5968a
commit
c41f7f1eff
17
scripts/rsshfs
Executable file
17
scripts/rsshfs
Executable file
@ -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
|
Loading…
Reference in New Issue
Block a user