useradd(8) on Solnix vs Linux and the BSDs
On Solnix, useradd is the illumos useradd at /usr/sbin/useradd. It writes /etc/passwd, /etc/shadow and /etc/user_attr, and its -p, -P, -R, -K and -Z mean different things than on Linux or NetBSD. A new login stays locked until passwd(1) is run.
The manual pages
- Solnix: useradd(8) from
pkgs.solnix.illumos-world-man· illumos.org - Linux: useradd(8) shadow-4.19.4
- FreeBSD: pw(8) 15.1-RELEASE (different command, similar job)
- NetBSD: useradd(8) 11.0
What Solnix runs
A default Solnix system runs the illumos useradd at /usr/sbin/useradd. No other variants are shipped. FreeBSD has no useradd in the bundle: its counterpart is pw(8) with the useradd keyword. The bundle has no OpenBSD counterpart page.
Differences
| Compared with | Topic | What differs |
|---|---|---|
| Linux, NetBSD | -p meaning | Solnix -p names a project (project(5)). Linux -p and NetBSD -p supply an already-encrypted password. A script that passes a password hash with -p will set a project name on Solnix instead.Source: Solnix useradd(8) -p projname; NetBSD useradd(8) -p password; Linux useradd(8) --password, -p |
| Linux | -R, -P and -Z meaning | Solnix -R assigns roles and -P assigns execution profiles. Linux -R/--root and -P/--prefix select alternate directories, and Linux -Z sets an SELinux user. On Solnix, -Z means never create a ZFS file system for the home directory.Source: Solnix useradd(8) -R, -P, -Z; Linux useradd(8) --root, --prefix, -Z, --selinux-user |
| Linux, FreeBSD, NetBSD | -K meaning | Solnix -K adds a key=value pair to the user's /etc/user_attr entry; the "type" key is rejected. Linux -K overrides /etc/login.defs values such as UID_MIN for this one call. The FreeBSD pw and NetBSD pages show no -K for useradd.Source: Solnix useradd(8) -K; Linux useradd(8) -K, --key; FreeBSD pw(8) SYNOPSIS useradd; NetBSD useradd(8) SYNOPSIS |
| Linux, NetBSD | new login is locked | Solnix creates the login locked, and it stays locked until passwd(1) is run. Linux and NetBSD can set a password at creation time with -p, using a pre-encrypted string. Solnix -p cannot do this.Source: Solnix useradd(8) DESCRIPTION; Linux useradd(8) -p; NetBSD useradd(8) -p |
| Linux, NetBSD | default primary group | Solnix without -g puts the user in the default group other (GID 1), changeable with useradd -D -g. Linux creates a group named after the user by default, subject to USERGROUPS_ENAB. NetBSD takes the default from usermgmt.conf, and -g =uid makes a matching new group.Source: Solnix useradd(8) -D, -g; Linux useradd(8) DESCRIPTION, -g; NetBSD useradd(8) -g |
| Linux, FreeBSD, NetBSD | where defaults are stored | Solnix keeps -D defaults in /etc/default/useradd (also used for EXCEED_TRAD and MANAGE_ZFS). Linux uses /etc/default/useradd plus /etc/login.defs. NetBSD uses /etc/usermgmt.conf. FreeBSD pw reads /etc/pw.conf, or the file given with -C.Source: Solnix useradd(8) DESCRIPTION, -m; Linux useradd(8) -b, -e, -g; NetBSD useradd(8) DESCRIPTION; FreeBSD pw(8) -C |
| Linux, NetBSD | -e expiry date format | Solnix -e takes a date in one of the formats in /etc/datemsk (see getdate(3C)); a null value " " disables expiry. Linux takes YYYY-MM-DD or days since 1970-01-01. NetBSD takes "month day year" or epoch seconds, and 0 disables.Source: Solnix useradd(8) -e; Linux useradd(8) -e, --expiredate; NetBSD useradd(8) -e |
| Linux | -f inactive meaning and disable value | Solnix -f is the maximum days between uses of a login before it becomes invalid; 0 defeats the check. Linux -f counts days after the password expires. On Linux, 0 disables the account at expiry and -1 turns the check off.Source: Solnix useradd(8) -f; Linux useradd(8) -f, --inactive |
| Linux, NetBSD | home directory creation and ZFS | Solnix -m creates the home directory. If its parent is on a separate ZFS file system and MANAGE_ZFS=YES is set in /etc/default/useradd, a new ZFS file system is created. -z forces one, -Z forbids one. Linux and NetBSD have no such option.Source: Solnix useradd(8) -m [-z|-Z]; Linux useradd(8) -m, -M; NetBSD useradd(8) -m |
| Linux | flags missing on Solnix | Solnix useradd has no -M, -N, -U, -l, -r or -F. Linux has all of these, including long forms like --no-create-home and --no-log-init. Scripts using them fail on Solnix.Source: Solnix useradd(8) SYNOPSIS; Linux useradd(8) OPTIONS (-M, -l, -F, --no-user-group, --user-group) |
| NetBSD | flags missing on Solnix, and -r | NetBSD -r is a uid range lowuid..highuid. Solnix has no -r. Solnix also lacks NetBSD's -L, -M, -S, -v and -F, and its -F means nothing. Solnix has -A, -P, -R and -K for RBAC attributes instead.Source: NetBSD useradd(8) SYNOPSIS, -r, -L, -M, -S, -v; Solnix useradd(8) SYNOPSIS |
| FreeBSD | different command and syntax | FreeBSD has no useradd. You run pw useradd name [options]. The name may come first and the keywords can be reordered. pw -N shows the result without updating the databases, and pw logs actions to /var/log/userlog. The Solnix page documents no dry-run option.Source: FreeBSD pw(8) SYNOPSIS, DESCRIPTION, -N, NOTES; Solnix useradd(8) SYNOPSIS |
| NetBSD | supplementary group limit | NetBSD -G takes a comma list or repeated options, with a maximum of 16 groups. Solnix -G is a comma list limited by NGROUPS_MAX, and duplicates with -g are ignored.Source: NetBSD useradd(8) -G; Solnix useradd(8) -G |
Everyday tasks
| Task | Solnix | Linux | FreeBSD | NetBSD |
|---|---|---|---|---|
| add a user with a home directory | useradd -m login | useradd -m LOGIN | pw useradd name -m | useradd -m user |
| show the defaults for new users | useradd -D | useradd -D | pw useradd -D | useradd -D |
| set the default login shell | useradd -D -s shell | useradd -D [options] | pw useradd -D -s shell | useradd -D -s shell |
| add a user to supplementary groups | useradd -G group[,group]... login | useradd -G GROUP1[,GROUP2...] LOGIN | pw useradd name -G grouplist | useradd -G secondary-group user |
Standards
- POSIX: useradd is not a POSIX.1-2024 utility.
Writing portable scripts
- Avoid
-p,-K,-R,-Pand-Zin portable scripts: they mean different things on Solnix, Linux and NetBSD. Create the account with a minimal useradd-m, then set the password afterwards with passwd(1). - Detect the tool (useradd or pw) and branch. Do not assume the default primary group, which is other on Solnix, per-user on Linux, and configured in usermgmt.conf on NetBSD.
Every difference here is taken from the manual pages linked above: Solnix's published page, Linux (man-pages and the GNU and util-linux manuals), FreeBSD, OpenBSD and NetBSD. Each row names its source. Where a manual is silent, this page is too. Compiled 2026-10-26. Found a mistake? Mail hackers@lists.solnix.io.