mirror of
https://github.com/ericonr/util-linux.git
synced 2024-04-21 09:12:35 -05:00
Various wording and formatting fixes. Nothing too contentnious, I think, so I rolled these changes into one patch. Since there is much common text in su.1 and runuser.1, I've combined the changes to both pages into one patch, and, as far as possible, ensured that changes to the common pieces of text match across the two pages. Signed-off-by: Michael Kerrisk (man-pages) <mtk.manpages@gmail.com>
292 lines
6.6 KiB
Groff
292 lines
6.6 KiB
Groff
.TH RUNUSER 1 "July 2014" "util-linux" "User Commands"
|
|
.SH NAME
|
|
runuser \- run a command with substitute user and group ID
|
|
.SH SYNOPSIS
|
|
.BR runuser " [options] " \-u
|
|
.I user
|
|
.RI "[[\-\-] " command " ["argument "...]]"
|
|
.LP
|
|
.BR runuser " [options] [" \- ]
|
|
.RI [ user " [" argument "...]]"
|
|
.SH DESCRIPTION
|
|
.B runuser
|
|
can be used to run commands with a substitute user and group ID.
|
|
If the option \fB\-u\fR is not given,
|
|
.B runuser
|
|
falls back to
|
|
.BR su -compatible
|
|
semantics and a shell is executed.
|
|
The difference between the commands
|
|
.B runuser
|
|
and
|
|
.B su
|
|
is that
|
|
.B runuser
|
|
does not ask for a password (because it may be executed by the root user only) and
|
|
it uses a different PAM configuration.
|
|
The command
|
|
.B runuser
|
|
does not have to be installed with set-user-ID permissions.
|
|
.PP
|
|
If the PAM session is not required,
|
|
then the recommended solution is to use the
|
|
.BR setpriv (1)
|
|
command.
|
|
.PP
|
|
When called without arguments,
|
|
.B runuser
|
|
defaults to running an interactive shell as
|
|
.IR root .
|
|
.PP
|
|
For backward compatibility,
|
|
.B runuser
|
|
defaults to not changing the current directory and to setting only the
|
|
environment variables
|
|
.B HOME
|
|
and
|
|
.B SHELL
|
|
(plus
|
|
.B USER
|
|
and
|
|
.B LOGNAME
|
|
if the target
|
|
.I user
|
|
is not root).
|
|
This version of
|
|
.B runuser
|
|
uses PAM for session management.
|
|
.PP
|
|
Note that
|
|
.B runuser
|
|
in all cases use PAM (pam_getenvlist()) to do
|
|
the final environment modification.
|
|
Command-line options
|
|
such as \fB\-\-login\fR and \fB\-\-preserve\-environment\fR affect
|
|
the environment before it is modified by PAM.
|
|
.SH OPTIONS
|
|
.TP
|
|
.BR \-c , " \-\-command" = \fIcommand
|
|
Pass
|
|
.I command
|
|
to the shell with the
|
|
.B \-c
|
|
option.
|
|
.TP
|
|
.BR \-f , " \-\-fast"
|
|
Pass
|
|
.B \-f
|
|
to the shell, which may or may not be useful, depending on the
|
|
shell.
|
|
.TP
|
|
.BR \-g , " \-\-group" = \fIgroup
|
|
The primary group to be used. This option is allowed for the root user only.
|
|
.TP
|
|
.BR \-G , " \-\-supp\-group" = \fIgroup
|
|
Specify a supplementary group.
|
|
This option is available to the root user only. The first specified
|
|
supplementary group is also used as a primary group
|
|
if the option \fB\-\-group\fR is not specified.
|
|
.TP
|
|
.BR \- , " \-l" , " \-\-login"
|
|
Start the shell as a login shell with an environment similar to a real
|
|
login:
|
|
.RS
|
|
.IP * 2
|
|
clears all the environment variables except for
|
|
.B TERM
|
|
and variables specified by \fB\-\-whitelist\-environment\fR
|
|
.IP *
|
|
initializes the environment variables
|
|
.BR HOME ,
|
|
.BR SHELL ,
|
|
.BR USER ,
|
|
.BR LOGNAME ,
|
|
and
|
|
.B PATH
|
|
.IP *
|
|
changes to the target user's home directory
|
|
.IP *
|
|
sets argv[0] of the shell to
|
|
.RB ' \- '
|
|
in order to make the shell a login shell
|
|
.RE
|
|
.TP
|
|
.BR \-P , " \-\-pty"
|
|
Create a pseudo-terminal for the session. The independent terminal provides
|
|
better security as the user does not share a terminal with the original
|
|
session.
|
|
This can be used to avoid TIOCSTI ioctl terminal injection and other
|
|
security attacks against terminal file descriptors.
|
|
The entire session can also be moved to the background
|
|
(e.g., "runuser \-\-pty \-u username \-\- command &").
|
|
If the pseudo-terminal is enabled, then
|
|
.B runuser
|
|
works as a proxy between the sessions (copy stdin and stdout).
|
|
.IP
|
|
This feature is mostly designed for interactive sessions.
|
|
If the standard input is not a terminal,
|
|
but for example a pipe (e.g., echo "date" | runuser \-\-pty \-u user),
|
|
then the ECHO flag for the pseudo-terminal is disabled to avoid messy output.
|
|
.TP
|
|
.BR \-m , " \-p" , " \-\-preserve\-environment"
|
|
Preserve the entire environment, i.e., do not set
|
|
.BR HOME ,
|
|
.BR SHELL ,
|
|
.B USER
|
|
or
|
|
.BR LOGNAME .
|
|
The option is ignored if the option \fB\-\-login\fR is specified.
|
|
.TP
|
|
.BR \-s , " \-\-shell" = \fIshell
|
|
Run the specified \fIshell\fR instead of the default. The shell to run is
|
|
selected according to the following rules, in order:
|
|
.RS
|
|
.IP * 2
|
|
the shell specified with
|
|
.B \-\-shell
|
|
.IP *
|
|
the shell specified in the environment variable
|
|
.B SHELL
|
|
if the
|
|
.B \-\-preserve\-environment
|
|
option is used
|
|
.IP *
|
|
the shell listed in the passwd entry of the target user
|
|
.IP *
|
|
/bin/sh
|
|
.RE
|
|
.IP
|
|
If the target user has a restricted shell (i.e., not listed in
|
|
/etc/shells), then the
|
|
.B \-\-shell
|
|
option and the
|
|
.B SHELL
|
|
environment variables are ignored unless the calling user is root.
|
|
.TP
|
|
.BI \-\-session\-command= command
|
|
Same as
|
|
.BR \-c ,
|
|
but do not create a new session. (Discouraged.)
|
|
.TP
|
|
.BR \-w , " \-\-whitelist\-environment" = \fIlist
|
|
Don't reset the environment variables specified in the
|
|
comma-separated \fIlist\fR when clearing the
|
|
environment for \fB\-\-login\fR. The whitelist is ignored for the environment variables
|
|
.BR HOME ,
|
|
.BR SHELL ,
|
|
.BR USER ,
|
|
.BR LOGNAME ", and"
|
|
.BR PATH "."
|
|
.TP
|
|
.BR \-V , " \-\-version"
|
|
Display version information and exit.
|
|
.TP
|
|
.BR \-h , " \-\-help"
|
|
Display help text and exit.
|
|
.SH CONFIG FILES
|
|
.B runuser
|
|
reads the
|
|
.I /etc/default/runuser
|
|
and
|
|
.I /etc/login.defs
|
|
configuration files. The following configuration items are relevant
|
|
for
|
|
.BR runuser :
|
|
.PP
|
|
.B ENV_PATH
|
|
(string)
|
|
.RS 4
|
|
Defines the PATH environment variable for a regular user. The
|
|
default value is
|
|
.IR /usr/local/bin:\:/bin:\:/usr/bin .
|
|
.RE
|
|
.PP
|
|
.B ENV_ROOTPATH
|
|
(string)
|
|
.br
|
|
.B ENV_SUPATH
|
|
(string)
|
|
.RS 4
|
|
Defines the
|
|
.B PATH
|
|
environment variable for root.
|
|
.B ENV_SUPATH
|
|
takes precedence. The default value is
|
|
.IR /usr/local/sbin:\:/usr/local/bin:\:/sbin:\:/bin:\:/usr/sbin:\:/usr/bin .
|
|
.RE
|
|
.PP
|
|
.B ALWAYS_SET_PATH
|
|
(boolean)
|
|
.RS 4
|
|
If set to
|
|
.I yes
|
|
and \-\-login and \-\-preserve\-environment were not specified
|
|
.B runuser
|
|
initializes
|
|
.BR PATH .
|
|
.RE
|
|
.sp
|
|
The environment variable
|
|
.B PATH
|
|
may be different on systems where
|
|
.I /bin
|
|
and
|
|
.I /sbin
|
|
are merged into
|
|
.IR /usr ;
|
|
this variable is also affected by the \fB\-\-login\fR command-line option and
|
|
the PAM system setting (e.g.,
|
|
.BR pam_env (8)).
|
|
.SH EXIT STATUS
|
|
.B runuser
|
|
normally returns the exit status of the command it executed. If the
|
|
command was killed by a signal,
|
|
.B runuser
|
|
returns the number of the signal plus 128.
|
|
.PP
|
|
Exit status generated by
|
|
.B runuser
|
|
itself:
|
|
.RS 10
|
|
.TP
|
|
1
|
|
Generic error before executing the requested command
|
|
.TP
|
|
126
|
|
The requested command could not be executed
|
|
.TP
|
|
127
|
|
The requested command was not found
|
|
.RE
|
|
.SH FILES
|
|
.PD 0
|
|
.TP 17
|
|
/etc/pam.d/runuser
|
|
default PAM configuration file
|
|
.TP
|
|
/etc/pam.d/runuser-l
|
|
PAM configuration file if \-\-login is specified
|
|
.TP
|
|
/etc/default/runuser
|
|
runuser specific logindef config file
|
|
.TP
|
|
/etc/login.defs
|
|
global logindef config file
|
|
.PD 1
|
|
.SH HISTORY
|
|
This \fB runuser\fR command was
|
|
derived from coreutils' \fBsu\fR, which was based on an implementation by
|
|
David MacKenzie, and the Fedora \fBrunuser\fR command by Dan Walsh.
|
|
.SH SEE ALSO
|
|
.BR setpriv (1),
|
|
.BR su (1),
|
|
.BR login.defs (5),
|
|
.BR shells (5),
|
|
.BR pam (8)
|
|
.SH AVAILABILITY
|
|
The runuser command is part of the util-linux package and is
|
|
available from
|
|
.UR https://\:www.kernel.org\:/pub\:/linux\:/utils\:/util-linux/
|
|
Linux Kernel Archive
|
|
.UE .
|