def set_permissions(filename, uid=None, gid=None, mode=<NUM_LIT>):
if uid is None:<EOL><INDENT>uid = get_ftp_uid()<EOL><DEDENT>if gid is None:<EOL><INDENT>gid = -<NUM_LIT:1><EOL><DEDENT>os.chown(filename, uid, gid)<EOL>os.chmod(filename, mode)<EOL>
Set pemissions for given `filename`.

Args:
    filename (str): name of the file/directory
    uid (int, default proftpd): user ID - if not set, user ID of `proftpd`
                                is used
    gid (int): group ID, if not set, it is not changed
    mode (int, default 0775): unix access mode