blob: 0de644e42a2279d290ae91ad36091fae3d9099d6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# 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"
local sftp_server="/usr/lib64/misc/sftp-server"
if [ -e /run/current-system/sw/bin/ssh ]; then
sftp_server="$(readlink -f /run/current-system/sw/bin/ssh)"
sftp_server="${sftp_server%/bin/ssh}/libexec/sftp-server"
fi
ssh "$@" "$target" mkdir -p "$remote_dir"
dpipe \
"$sftp_server" \
= \
ssh "$@" "$target" sshfs -o idmap=user -o passive -o allow_other \
":$local_dir" "$remote_dir"
}
|