documentation of similarities and (noteworthy) differencies between Unix systems
commit: 2a3fc9f6b61bbfd1ce6a26ef494c3a9391e35d55
parent: df32194ba0496b64a02c80653a4dc5b7d1c6e6bc
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Wed,  6 Mar 2019 06:21:32 +0100

man1x/su.1x: New manpage


1 file changed, 75 insertions(+), 0 deletions(-)

diff --git a/man1x/su.1x b/man1x/su.1x @@ -0,0 +1,75 @@ +.\" This file is part of Cross Unix Documentation +.\" Copyright © 2019 Haelwenn (lanodan) Monnier <contact@hacktivis.me> +.\" SPDX-License-Identifier: CC-BY-4.0 +.Dd 2019-03-06 +.Dt SU 1x +.Os +.Sh PROLOG +This manual page is part of +.Lk https://hacktivis.me/git/cross-unix-documentation "Cross-Unix Documentation" +which is an attempt to provide documentation of similarities and (noteworthy) differencies between Unix-like systems. To be used as an addition to the POSIX standard. +.Sh NAME +.Nm su +.Nd switch user / become superuser +.Sh SYNOPSIS +.Nm +.Op Fl plm +.Op Fl c Ar command +.Op Fl s Ar shell +.Op - +.Op username Op shell arguments +.Sh DESCRIPTION +The +.Nm +utility is used to run a command or get a shell as another user, without having to log out. +By default the environment is unmodified with the exception of LOGNAME, HOME, SHELL, and USER. +HOME and SHELL are set to the target user’s default values. LOGNAME and USER are set to the target user, unless the target user has a UID of 0 and +.Fl l +was not specified, in which case it is unmodified. The invoked shell is the target user’s. This is the traditional behaviour of su. +If not using +.Fl m +and the target login has a UID of 0 then the PATH variable and umask are set to implementation defined behaviour. +.Pp +If +.Op username +was not set it defaults to UID 0 (also known as Super-User). +.Bl -tag -width Ds +.It - , Fl l +Simulate a full login, this discards the origin user’s environment, expect for few implementation defined ones (like TERM). Absent in BusyBox. +.It Fl c Ar command +Executes +.Ar command +as the target user. This flag is used for "login class" in +.Nx , +.Fx and +.Ox , +where you must pass the command by appending it to the end, along with the target user’s username. +.It Fl p , Fl m +Preserve the environment, few exceptions are present between implementations. +GNU: preserve expect for PATH and IFS +.It Fl s Ar shell +Login to target user with +.Ar shell +instead of their default one. This is absent in +.Nx +.It Op shell arguments +Executes the remaining +.Op shell arguments +in the target user's shell non-interactively. This seems to be absent in Busybox. +.Sh SOURCE +GNU coreutils 8.30, Busybox 1.30.1, +.Ox 6.4 , +.Nx 8.0 , +.Fx 12.0 +.Sh SEE ALSO +.Xr sudo 1 , +.Xr doas 1 , +.Xr login 1 , +.Xr environ 7 . +.Sh HISTORY +A +.Nm +command appeared in +.At v7 . +.Sh AUTHORS +.An Haelwenn (lanodan) Monnier Aq Mt contact+c-u-d@hacktivis.me