diff options
author | Karel Kočí <cynerd@email.cz> | 2021-04-08 11:09:14 +0200 |
---|---|---|
committer | Karel Kočí <cynerd@email.cz> | 2021-04-08 11:09:14 +0200 |
commit | 2cb9c97f879abb26a911bd8f1d887cbbe4b4d792 (patch) | |
tree | 6c822e46159ff461741d01e16cd62609e9fd2e92 /shellrc.d-desktop/ssh | |
parent | 254e1f09f97bfdf5e117a95103dad3fcd8b3eb5e (diff) | |
download | shellrc-2cb9c97f879abb26a911bd8f1d887cbbe4b4d792.tar.gz shellrc-2cb9c97f879abb26a911bd8f1d887cbbe4b4d792.tar.bz2 shellrc-2cb9c97f879abb26a911bd8f1d887cbbe4b4d792.zip |
shellrc.d-desktop/ssh: add sshcfs
This is helper to do reverse SSHFS mount.
Diffstat (limited to 'shellrc.d-desktop/ssh')
-rw-r--r-- | shellrc.d-desktop/ssh | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/shellrc.d-desktop/ssh b/shellrc.d-desktop/ssh new file mode 100644 index 0000000..3471484 --- /dev/null +++ b/shellrc.d-desktop/ssh @@ -0,0 +1,18 @@ +# vim: ft=sh: +# These are general ssh helpers that are most likely not usable on server side +# anyway thus they are deployed on desktop only. + +# SSHFS in client mode. In other words it is reverse sshfs mount. +sshcfs() { + local target="$1" + local local_dir="$2" + local remote_dir="$3" + shift 3 + [[ "$local_dir" = /* ]] || local_dir="$PWD/$local_dir" + + ssh "$@" "$target" mkdir -p "$remote_dir" + tbg dpipe \ + /usr/lib64/misc/sftp-server \ + = \ + ssh "$@" "$target" sshfs -o slave ":$local_dir" "$remote_dir" +} |