wok-current view sshfs-fuse/stuff/rsshfs @ rev 16762

sshfs-fuse/rsshfs: do not trust remote read-only option
author Pascal Bellard <pascal.bellard@slitaz.org>
date Tue Jun 17 10:26:10 2014 +0200 (2014-06-17)
parents b55261bbc2a9
children f378d6411e2c
line source
1 #!/bin/sh
2 # from https://github.com/rom1v/rsshfs
4 rhost="${2%%:*}"
5 rpath="${2#*:}"
6 lpath="$1"
7 shift 2
9 case "$lpath" in
10 -u) ssh "$rhost" fusermount -u $@ "$rpath"
11 ;;
13 ''|-*) cat <<EOT
14 usage:
15 $0 localpath remotehost:remotepath [-o ro -o allow_other]
16 $0 -u remotehost:remotepath [-z]
17 EOT
18 ;;
20 *) fifo=/tmp/rsshfs-$$
21 mkfifo $fifo
22 case " $@ " in
23 *\ -o\ ro\ *) sftp-server -R ;;
24 *) sftp-server ;;
25 esac <$fifo | ssh "$rhost" sshfs -o slave ":$lpath" "$rpath" "$@" >$fifo
26 rm -f $fifo
27 esac