def chown(path, user=None, group=None):
    """change ownership of path"""
    import os
    import pwd
    import grp
    uid = pwd.getpwnam(user).pw_uid if user else -1
    gid = grp.getgrnam(group).gr_gid if group else -1
    return os.chown(path, uid, gid)
def chown ( path , user = None , group = None ) : import os import pwd import grp uid = pwd . getpwnam ( user ) . pw_uid if user else - 1 gid = grp . getgrnam ( group ) . gr_gid if group else - 1 return os . chown ( path , uid , gid )
change ownership of path