import re


def unix_check(string):
    """Validate input for username and group names which should be alpha numeric only with no spaces or special chars not allowed in user/group names.

    Borrowed from: https://unix.stackexchange.com/questions/157426/what-is-the-regex-to-validate-linux-users

    Should match 31 char unix usernames and groups
    """
    matched = re.match(r"^[a-z_]([a-z0-9_-]{0,31}|[a-z0-9_-]{0,30}\$)$", string)
    if bool(matched):
        return string
    raise ValueError("Intagers only, optionally prefixed with + or -")