zlogin(1) on Solnix vs Linux and the BSDs
zlogin is the illumos command at /usr/sbin/zlogin. It runs a shell, a command or the console inside a zone named by zone name, and only the superuser in the global zone can use it. Linux nsenter and machinectl and FreeBSD jexec do similar jobs but take different arguments, and several single-letter flags mean something else.
The manual pages
- Solnix: zlogin(1) from
pkgs.solnix.illumos-world-man· illumos.org - Linux: nsenter(1) util-linux-2.42.3 (different command, similar job)
- Linux: machinectl(1) systemd-260.5 (different command, similar job)
- FreeBSD: jexec(8) 15.1-RELEASE (different command, similar job)
What Solnix runs
A default Solnix system runs the illumos zlogin at /usr/sbin/zlogin. No other variants are shipped. The OpenBSD and NetBSD counterparts are not in the bundle, so this page compares only Linux and FreeBSD.
Differences
| Compared with | Topic | What differs |
|---|---|---|
| Linux, FreeBSD | how the target is named | zlogin takes a zone name. FreeBSD jexec takes a jail id or name. Linux nsenter takes a target process with -t PID and the namespaces to enter. machinectl takes a machine NAME.Source: Solnix zlogin(1) SYNOPSIS, OPERANDS; FreeBSD jexec(8) DESCRIPTION; Linux nsenter(1) -t, --target; Linux machinectl(1) SYNOPSIS |
| Linux | -n meaning | Solnix zlogin -n redirects stdin from /dev/null. Linux nsenter -n (--net) enters the network namespace. A script that passes -n to nsenter to stop it reading stdin will change namespaces instead.Source: Solnix zlogin(1) -n; Linux nsenter(1) -n, --net |
| Linux | -C meaning | Solnix zlogin -C connects to the zone console. Linux nsenter -C (--cgroup) enters the cgroup namespace.Source: Solnix zlogin(1) -C; Linux nsenter(1) -C, --cgroup |
| FreeBSD | -l, -d and -u meanings | zlogin -l username picks the zone user, and -d disconnects from the console when the zone halts. jexec -l gives a clean environment, -d sets the working directory, and -u/-U choose the user.Source: Solnix zlogin(1) -l, -d; FreeBSD jexec(8) -l, -d, -u, -U |
| Linux, FreeBSD | default user | zlogin uses "root" unless -l is given. jexec -u, the default, takes a user name from the host environment, and -U takes one from inside the jail. machinectl shell --uid defaults to root. The nsenter text in the bundle does not say.Source: Solnix zlogin(1) -l; FreeBSD jexec(8) -u, -U; Linux machinectl(1) --uid |
| Linux, FreeBSD | login setup and environment | Interactive zlogin runs login(1) on a new pseudo terminal. With a utility it runs su(8) to set up a login environment. jexec gets a clean environment only with -l, which sets PATH to /bin:/usr/bin. The nsenter text does not describe the environment.Source: Solnix zlogin(1) Interactive Mode, Non-Interactive Mode; FreeBSD jexec(8) -l |
| Linux, FreeBSD | command is a shell string | In non-interactive mode zlogin passes the command as a string interpreted by a shell in the zone (see rsh(1)). The jexec and nsenter pages describe a program with arguments and do not say a shell interprets it. Source: Solnix zlogin(1) Non-Interactive Mode; FreeBSD jexec(8) SYNOPSIS; Linux nsenter(1) SYNOPSIS |
| Linux, FreeBSD | no command given | zlogin with no utility and a tty on stdin starts an interactive login. jexec runs the user's shell. nsenter runs "${SHELL}" (default /bin/sh).Source: Solnix zlogin(1) Interactive Mode; FreeBSD jexec(8) DESCRIPTION; Linux nsenter(1) DESCRIPTION |
| Linux, FreeBSD | exit status | Only in non-interactive mode does zlogin return the utility's exit status. In interactive and console modes it exits 0 unless a connection error occurs. It exits 1 on permission denied or failure to enter. The jexec page has no exit status section. Source: Solnix zlogin(1) EXIT STATUS; FreeBSD jexec(8) (no EXIT STATUS section) |
| Linux, FreeBSD | console and safe mode | zlogin -C attaches to the zone console, which persists across zone reboots. -S does minimal processing without login(1) or su(8), to recover a damaged zone. The jexec page has no console or safe-login option.Source: Solnix zlogin(1) Console Mode, -S; FreeBSD jexec(8) OPTIONS |
| Linux, FreeBSD | escape sequences | zlogin treats lines starting with ~ as escape sequences. ~. disconnects without warning to the zone. -e c changes the escape character and -E disables it. The jexec page documents no escape sequences.Source: Solnix zlogin(1) -e, -E, Escape Sequences; FreeBSD jexec(8) OPTIONS |
| Linux, FreeBSD | NFS restriction | zlogin fails if its open files or any part of its address space, including the executable or shared libraries, are on NFS. The other pages do not mention this. Source: Solnix zlogin(1) NOTES |
Everyday tasks
| Task | Solnix | Linux | FreeBSD |
|---|---|---|---|
| get a shell in a zone, jail or container | zlogin zonename | nsenter -t PID -a, or machinectl shell NAME | jexec jail |
| run one command inside | zlogin zonename utility [argument]... | nsenter -t PID -a program [arguments] | jexec jail command ... |
| run as a named user | zlogin -l username zonename | machinectl --uid=user shell NAME | jexec -U username jail |
| attach to the console | zlogin -C zonename | — | — |
| run in a clean environment | — | — | jexec -l jail |
Standards
- POSIX: zlogin is not a POSIX.1-2024 utility.
- Solnix: Interface Stability: Evolving.
Writing portable scripts
- There is no common syntax. Branch on which of zlogin, jexec, nsenter or machinectl exists, and do not pass the same flags to each, since
-n,-Cand-lmean different things. - Use the exit status only from non-interactive zlogin (with a utility). In interactive and console modes zlogin does not return the inner exit status.
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.