Created
March 10, 2015 14:02
-
-
Save ChrisBuchholz/ad19fc0d289f80a9c3bb to your computer and use it in GitHub Desktop.
mount a remote folder over ssh
This file contains 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
rmount () { | |
# | |
# requires osxfuse, sshfs and ssh-copy-id and that you have keyless | |
# ssh login set up between you and the remote | |
# | |
# usage: | |
# rmount 99.99.99.99 /some/path | |
# | |
# if you leave out the path it defaults to ./ (home folder) | |
# | |
REMOTE_HOST=$1 | |
REMOTE_PATH=$2 | |
MOUNT_PATH=/Volumes/$REMOTE_HOST | |
if [ -z "$2" ]; then | |
REMOTE_PATH=./ | |
fi | |
[ -d $MOUNT_PATH ] || mkdir $MOUNT_PATH | |
sshfs -o reconnect -o volname=$REMOTE_HOST -o IdentityFile=~/.ssh/id_rsa $REMOTE_HOST:$REMOTE_PATH $MOUNT_PATH && open $MOUNT_PATH | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment