Hi,

Why not utilize -r or --system as per useradd(8) in order to add system users?

The limits for the allocated user ids comes from /etc/login.defs.

Kind Regards,
Jaco

On 2019/05/30 14:50, Michał Górny wrote:
Signed-off-by: Michał Górny <mgo...@gentoo.org>
---
  eclass/user.eclass | 2 ++
  1 file changed, 2 insertions(+)

diff --git a/eclass/user.eclass b/eclass/user.eclass
index 1ffeaae29569..b16c4c6d69b7 100644
--- a/eclass/user.eclass
+++ b/eclass/user.eclass
@@ -160,6 +160,7 @@ enewuser() {
                for ((euid = 101; euid <= 999; euid++)); do
                        [[ -z $(egetent passwd ${euid}) ]] && break
                done
+               [[ ${euid} -le 999 ]] || die "${FUNCNAME}: no free UID found"
        fi
        opts+=( -u ${euid} )
        einfo " - Userid: ${euid}"
@@ -344,6 +345,7 @@ enewgroup() {
                        for ((egid = 101; egid <= 999; egid++)) ; do
                                [[ -z $(egetent group ${egid}) ]] && break
                        done
+                       [[ ${egid} -le 999 ]] || die "${FUNCNAME}: no free GID 
found"
                fi
        }

Reply via email to