func LookupUserOtherThan()

in integration/utils/user.go [126:148]


func LookupUserOtherThan(username ...string) (*UnixUser, error) {
	// Testing a bunch of low-numbered UIDs should be sufficient because most Unix systems,
	// if not all, have system accounts immediately after 0.
	var other *UnixUser
	for i := 1; i < 100; i++ {
		var err error
		other, err = LookupUID(i)
		if err != nil {
			continue
		}

		for _, name := range username {
			if other.Username == name {
				continue
			}
		}
		break
	}
	if other == nil {
		return nil, fmt.Errorf("cannot find an unprivileged user other than %v", username)
	}
	return other, nil
}