#!/usr/bin/env python import xmlrpclib as x import sys import os if len(sys.argv) != 4: sys.exit(0) home = sys.argv[1] group = sys.argv[2] user = sys.argv[3] media = "/media/" + user s = x.ServerProxy('https://server:9779') list_acl = s.get_acl_group_filtered('','NetFoldersManager',group) try: apply_nobody_nogroup = False if len(list_acl) > 0: list_acl.append(['-m','u:'+user+':rwx']) apply_nobody_nogroup = True for x in list_acl: os.system('setfacl ' + ' '.join(x) + ' "' + home + '"') # Apply --- to others to every single home os.system('setfacl -m o:--- "%s"'%home) if os.path.exists(media): os.system('setfacl -kb ' + media ) os.system('setfacl -m u:'+ user+ ':rx ' + media ) if apply_nobody_nogroup: os.system('chown ' + user+':nogroup "' + home + '"') except Exception as e: pass