#!/usr/bin/env python3 #import xmlrpclib as x import xmlrpc.client as x import ssl import sys import os if len(sys.argv) != 4: sys.exit(0) home = sys.argv[1] group = sys.argv[2] user = sys.argv[3] context=ssl._create_unverified_context() s = x.ServerProxy('https://server:9779',allow_none=True,context=context) 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 apply_nobody_nogroup: os.system('chown ' + user+':nogroup "' + home + '"') except Exception as e: pass