-
-
Notifications
You must be signed in to change notification settings - Fork 2
Description
Thanks for the script, I'm giving it a try, predominantly for the easy use of port-forwarding. (I found reference to it at https://unix.stackexchange.com/a/666390/176511.)
I had a few thoughts while starting it: mostly for discussion now, it's easy enough to break these into individual issues if you find them worthwhile. (And #3 is an easy PR.)
-
Do not (either by option or at all)
rmdirthe mount-point. In my use-cases, having the base-directory persist when not mounted is important. -
Add
DynamicForwardto the list of supported port-forward rules. This worked well enough by adding simplyDFwd=$(fetchHostAttribute "$Host" "---" "DynamicForward" "-D"); [[ -n "$DFwd" && "$DFwd" != "2" ]] && { sshopts="$sshopts$DFwd"; }though (minor) it added a colon after the port. For instance, in
fsconfigif I haveDynamicForward 127.0.0.1:5000, then the command line includes-D 127.0.0.1:5000:. It still works, but ... I didn't investigate why that's happening (likely parsing of an expected pattern). -
(Bug.)
sshmount -u remoteunmounts but thesshcommand is still running. I would expect the script to kill the ssh that it starts. I suspect this may be related to passing assh_commandto sshfs, but I don't recall running into problems on that end before ... -
(Minor bug when my muscle-memory errs.) I'm accustomed to doing
fusermount -u /mountpoint, but doing that results in$ sshmount -u /mountpoint sed: -e expression #1, char 14: expected newer version of sed sed: -e expression #1, char 14: expected newer version of sed sed: -e expression #1, char 14: expected newer version of sed 2 is not mountedI don't think it'd be necessary to auto-detect a
LocalDirectoryas an argument and self-fix the mistake, but perhaps the script can better guard against this kind of "injection" insed -n "/$1$/,/^$2/por such. I suspect without verification that escaping or removing/in the arguments would suffice to squash the error, though it'll still likely not find something. -
Big ask: is it possible to retrieve all
LocalForwardfrom the actual.ssh/configfile? Perhaps that's a bridge too far ...I'm not suggesting you remove support within
.ssh/fsconfig, but there are (for me) clear use-cases where I'm not sshfs-mounting but will need the port-forwarding for other purposes. While it's not herculean to maintain both, it does introduce an opportunity to have two different forwarding rulesets. This does not require reading/parsing the.ssh/configfile, most versions ofsshsupport the-Goption, so thatssh -G remote | grep -E "(local|remote|dynamic)forward"can be used, perhaps directly. Perhaps this would be an option in.ssh/fsconfigsuch asPortForwardingFromSshConfig yes.
Thanks for the script! I'll be playing with it for a bit.