Page MenuHomeFreeBSD

D26941.diff
No OneTemporary

D26941.diff

Index: usr.bin/su/su.1
===================================================================
--- usr.bin/su/su.1
+++ usr.bin/su/su.1
@@ -28,7 +28,7 @@
.\" @(#)su.1 8.2 (Berkeley) 4/18/94
.\" $FreeBSD$
.\"
-.Dd March 26, 2020
+.Dd October 25, 2020
.Dt SU 1
.Os
.Sh NAME
@@ -84,7 +84,7 @@
are also normally retained unless the target login has a user ID of 0.
.Pp
The options are as follows:
-.Bl -tag -width Ds
+.Bl -tag -width "-c class"
.It Fl c Ar class
Use the settings of the specified login class.
The login class must be defined in
@@ -164,6 +164,16 @@
.Nm
itself, everything after the target login name gets passed to the login
shell.
+For example,
+.D1 su -c daemon root
+starts a new shell as root with the settings of the daemon login class,
+while
+.D1 su root -c daemon
+starts
+.Xr daemon 8
+as root with its default login class
+which is roughly equivalent to
+.Dl csh -c "daemon"
.Pp
By default (unless the prompt is reset by a startup file) the super-user
prompt is set to
@@ -196,7 +206,7 @@
.Bl -tag -width 5n -compact
.It Li "su -m operator -c poweroff"
Starts a shell as user
-.Li operator ,
+.Dq operator ,
and runs the command
.Li poweroff .
You will be asked for operator's password unless your real UID is 0.
@@ -204,13 +214,18 @@
.Fl m
option is required since user
.Dq operator
-does not have a valid shell by default.
+does not have a valid shell by default
+.Po it is set to
+.Xr nologin 8 Pc .
In this example,
+the shell of your user is used to execute the command.
+Also,
.Fl c
-is passed to the shell of the user
-.Dq operator ,
-and is not interpreted as an argument to
-.Nm .
+is an argument to the shell as it is specified after the login
+.Po
+.Dq operator
+in this case
+.Pc .
.It Li "su -m operator -c 'shutdown -p now'"
Same as above, but the target command consists of more than a
single word and hence is quoted for use with the

File Metadata

Mime Type
text/plain
Expires
Thu, Jul 30, 7:36 PM (1 h, 38 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
35753652
Default Alt Text
D26941.diff (1 KB)

Event Timeline