Created
February 11, 2017 15:00
-
-
Save Hubbitus/c40d986921cbed6a8ad585eee00a7d77 to your computer and use it in GitHub Desktop.
Afuse sshfs automounter (/usr/sbin/mount.afuse)
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
#!/bin/bash | |
# afuse-sshfs mount helper to automatically mount remote machines. | |
# It is intended to be used as mount.afuse in command line. F.e. in /etc/fstab you may mount directory like: | |
# afuse# /mnt/remote afuse auto 0 0 | |
# And then as regular user just do: | |
# $ cd /mnt/remote/[email protected]/remote/path | |
# and folder /mnt/remote/[email protected] will be mounted automatically! | |
# | |
# On Mac some also recommend add defer_permissions,noappledouble mount options. | |
# Mount under user and group which are owners of mount point | |
su -l $( ls -dl "$2" | cut -d' ' -f3) -c "afuse -o mount_template='sshfs -o reconnect -o auto_cache -o kernel_cache %r:/ %m' -o unmount_template='fusermount -u -z %m' -o auto_unmount '$2'" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@vonpupp, user, who will use it. Automount script will automatically get owner user from directory and run mount under he.