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/user@remote.host/remote/path | |
# and folder /mnt/remote/user@remote.host 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'" |
@Hubbitus, who should the the owner and group of the /mnt/remote folder? Do you use a group for the users that are able to use afuse? Thanks.
@vonpupp, user, who will use it. Automount script will automatically get owner user from directory and run mount under he.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Habrahabr post on Russian about this gist file helper: https://habrahabr.ru/post/321636/