Last active
March 23, 2017 07:36
-
-
Save shaitan/0be476c9b7615951fd59 to your computer and use it in GitHub Desktop.
sshfs mount
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
import os | |
local_base_dir = '/Users/user' | |
mount_points = { | |
'host' : { | |
'/home/user': 'volume' | |
} | |
} | |
def main(): | |
for host in mount_points: | |
for remote_path in mount_points[host]: | |
volume = mount_points[host][remote_path] | |
local_dir = os.path.join(local_base_dir, volume) | |
if not os.path.exists(local_dir): | |
os.mkdir(local_dir) | |
else: | |
assert os.path.isdir(local_dir) | |
if os.path.ismount(local_dir): | |
os.system('diskutil umount force {}'.format(local_dir)) | |
os.system('sshfs {}:{} {} -oauto_cache,reconnect,defer_permissions,noappledouble,negative_vncache,volname={},Ciphers=arcfour,compression=no,kernel_cache' | |
.format(host, remote_path, local_dir, volume)) | |
if __name__ == '__main__': | |
import sys | |
sys.exit(main()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment