Created
June 7, 2022 01:45
-
-
Save 0187773933/e2d761527d3483ec0d6e510c360aae50 to your computer and use it in GitHub Desktop.
Mounts a Single Hop Destination Folder to Local Mac OSX Folder
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
trap unmount INT | |
LOCAL_MOUNT_POINT="/Users/morpheous/MOUNT/WIRE" | |
LOCAL_PATH_TO_SSH_KEY="/path/to/private-key/raspi-wi" | |
SSH_COMMAND=$(echo ssh -i "$LOCAL_PATH_TO_SSH_KEY" -o UserKnownHostsFile=/dev/null -o IdentitiesOnly=yes -o StrictHostKeyChecking=no -F /dev/null) | |
function unmount() { | |
echo unmounting "$LOCAL_MOUNT_POINT" | |
sudo umount "$LOCAL_MOUNT_POINT" || true | |
sudo diskutil unmount force "$LOCAL_MOUNT_POINT" || true | |
sudo rm -rf "$LOCAL_MOUNT_POINT" || true | |
} | |
unmount | |
sudo sshfs \ | |
-o reconnect,allow_other,defer_permissions \ | |
-o debug,sshfs_debug,loglevel=debug \ | |
-o ssh_command="$SSH_COMMAND" \ | |
[email protected]:/home/morphs/DOCKER_IMAGES/WI \ | |
"$LOCAL_MOUNT_POINT" | |
echo "done" | |
unmount |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment