aboutsummaryrefslogtreecommitdiff
path: root/shellrc.d-desktop/ssh
blob: 51cb9236b35803cadb4d6bd796c222ce5f78cb45 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# 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 idmap=user -o passive -o allow_other \
			":$local_dir" "$remote_dir"
}