su(8) on Solnix vs Linux and the BSDs

On Solnix, su is the illumos su, found at /usr/bin/su and /sbin/su. Its synopsis is only `su [-] [username [arg...]]`, with no options. Linux and the BSDs all have options, and `-c` means a command on Linux but a login class on the BSDs. On Solnix, `-c string` is an argument for the target user's shell.

What Solnix runs

A default Solnix system runs the illumos su at /usr/bin/su and /sbin/su. No other variants are shipped. The page documents no options other than a leading `-`, and every extra argument goes to the new shell.

Differences

Compared withTopicWhat differs
all fouroptionsThe Solnix synopsis has no options except a leading `-`. Linux documents -c, -l, -m/-p and -s. FreeBSD documents -c, -f, -l, -m and -s. OpenBSD adds -a, -K and -L. NetBSD adds -d and -K. Scripts using these flags need rewriting for Solnix.
Source: Solnix su(8) SYNOPSIS; Linux su(1) OPTIONS; FreeBSD su(1) SYNOPSIS; OpenBSD su(1) SYNOPSIS; NetBSD su(1) SYNOPSIS
all four-c meaningOn Solnix, `-c string` is not a su option. It is an argument after the username, passed to the new shell, which runs the string. On Linux, su's own -c COMMAND runs a command. On FreeBSD, OpenBSD and NetBSD, su's -c selects a login class.
Source: Solnix su(8) DESCRIPTION (arg of the form -c string); Linux su(1) -c; FreeBSD su(1) -c class; OpenBSD su(1) -c login-class; NetBSD su(1) -c
all fourpreserving the environmentSolnix has no -m, and the page does not document keeping the caller's shell or environment. Linux has -m/-p. FreeBSD, OpenBSD and NetBSD have -m, which keeps the environment and your own login shell. Without -m or -l, Solnix passes the environment through except $PATH.
Source: Solnix su(8) DESCRIPTION; Linux su(1) -m, -p; FreeBSD su(1) -m; OpenBSD su(1) -m; NetBSD su(1) -m
all fourwhere PATH is setWithout `-`, Solnix takes $PATH from PATH and SUPATH in /etc/default/su. Linux resets it to /bin:/usr/bin (or the superuser list), changeable via ENV_PATH and ENV_SUPATH in /etc/login.defs. OpenBSD and NetBSD use login.conf(5). FreeBSD -l sets /bin:/usr/bin.
Source: Solnix su(8) DESCRIPTION; Linux su(1) DESCRIPTION; OpenBSD su(1) -l; NetBSD su(1) -l; FreeBSD su(1) -l
all fourlogin environment (su -)On Solnix, `su -` also propagates LC* and LANG, propagates TZ (falling back to TIMEZONE in /etc/default/login) and sets MAIL to /var/mail/new_user. The other systems list different variables: FreeBSD keeps HOME, SHELL, PATH, TERM and USER, and NetBSD adds LOGNAME and SU_FROM.
Source: Solnix su(8) DESCRIPTION (su -); FreeBSD su(1) -l; NetBSD su(1) -l; OpenBSD su(1) -l; Linux su(1) -l
all fourLD_ variablesSolnix su removes every variable with an LD_ prefix from the environment, so they do not survive `su bin`. The Linux, FreeBSD, OpenBSD and NetBSD pages in the bundle do not mention LD_ variables.
Source: Solnix su(8) ENVIRONMENT VARIABLES; Linux, FreeBSD, OpenBSD, NetBSD su(1) ENVIRONMENT/OPTIONS
FreeBSD, OpenBSD, NetBSDwho may become rootFreeBSD limits su to root to the wheel group through pam_group in /etc/pam.d/su. OpenBSD and NetBSD use group 0 (wheel) as listed in /etc/group. The Solnix page documents no group restriction, only that a password is needed unless the caller is root.
Source: FreeBSD su(1) DESCRIPTION; OpenBSD su(1) DESCRIPTION; NetBSD su(1) DESCRIPTION; Solnix su(8) DESCRIPTION
all fourloggingSolnix logs all attempts to become another user in /var/adm/sulog (see sulog(5)). Linux says all attempts, valid and invalid, are logged but names no file. The FreeBSD, OpenBSD and NetBSD pages in the bundle do not describe su logging.
Source: Solnix su(8) DESCRIPTION; Linux su(1) DESCRIPTION
all fourshell selectionSolnix runs the shell from the target's passwd entry, falling back to /usr/bin/sh, and to /sbin/sh if the superuser's shell cannot be exec'd. There is no -s. Linux -s and OpenBSD -s pick a shell, but only root may override on OpenBSD. FreeBSD -s sets a MAC label.
Source: Solnix su(8) DESCRIPTION; Linux su(1) -s; OpenBSD su(1) -s; FreeBSD su(1) -s
FreeBSD, OpenBSD, NetBSDlogin class and projectFreeBSD, OpenBSD and NetBSD apply a login class from login.conf(5) (-c). Solnix instead sets the new shell's project ID to the target user's default project. The Solnix page has no login class option.
Source: Solnix su(8) DESCRIPTION (project ID); FreeBSD su(1) -c class; OpenBSD su(1) -c; NetBSD su(1) -c
NetBSDgroup syntax and exit statusNetBSD accepts login:group and documents its exit status: the subshell's status, or 1 if switching privileges failed. The Solnix synopsis has no group form, and its page does not document an exit status.
Source: NetBSD su(1) SYNOPSIS, EXIT STATUS; Solnix su(8) SYNOPSIS
OpenBSDroot with shell argumentsOpenBSD documents that the login name is not optional for root when shell arguments are given. The Solnix page documents no such restriction and says the default user name is root.
Source: OpenBSD su(1) BUGS; Solnix su(8) DESCRIPTION

Standards

  • POSIX: su is not a POSIX.1-2024 utility.
  • FreeBSD: A su command appeared in Version 1 AT&T UNIX.
  • OpenBSD: A su command first appeared in Version 1 AT&T UNIX.
  • NetBSD: An su utility appeared in Version 1 AT&T UNIX.

Writing portable scripts

  • Do not use su's -c, -m or -s in portable scripts. They mean different things on Linux and the BSDs and do not exist as options on Solnix.
  • To run one command as another user, `su username -c 'cmd'` passes -c to that user's shell on Solnix, but check the other systems' pages before relying on it. Argument order and -c handling differ.

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.