Read passwd file and return dict with users and all their settings.

    Args:
        path (str, default settings.LOGIN_FILE): path of the file,
            which will be loaded (default :attr:`ftp.settings.LOGIN_FILE`).

    Returns:
        (dict): username: {pass_hash, uid, gid, full_name, home, shell}

    Example of returned data::

        {
            "xex": {
                "pass_hash": "$asd$aiosjdaiosjdásghwasdjo",
                "uid": "2000",
                "gid": "2000",
                "full_name": "ftftf",
                "home": "/home/ftp/xex",
                "shell": "/bin/false"
            }
        }

def load_users(path=settings.LOGIN_FILE):
    """
    Read passwd file and return dict with users and all their settings.

    Args:
        path (str, default settings.LOGIN_FILE): path of the file,
            which will be loaded (default :attr:`ftp.settings.LOGIN_FILE`).

    Returns:
        (dict): username: {pass_hash, uid, gid, full_name, home, shell}

    Example of returned data::

        {
            "xex": {
                "pass_hash": "$asd$aiosjdaiosjdásghwasdjo",
                "uid": "2000",
                "gid": "2000",
                "full_name": "ftftf",
                "home": "/home/ftp/xex",
                "shell": "/bin/false"
            }
        }
    """
    if not os.path.exists(path):
        return {}

    data = ""
    with open(path) as f:
        data = f.read().splitlines()

    users = {}
    cnt = 1
    for line in data:
        line = line.split(":")

        assert len(line) == 7, "Bad number of fields in '%s', at line %d!" % (
            path,
            cnt
        )

        users[line[0]] = {
            "pass_hash": line[1],
            "uid": line[2],
            "gid": line[3],
            "full_name": line[4],
            "home": line[5],
            "shell": line[6]
        }

        cnt += 1

    return users