]> git.ipfire.org Git - thirdparty/util-linux.git/blame - login-utils/runuser.1.adoc
Fix several adoc files as reported by Helge Kreutzmann
[thirdparty/util-linux.git] / login-utils / runuser.1.adoc
CommitLineData
295b3979 1//po4a: entry man manual
a7574d88
MB
2= runuser(1)
3:doctype: manpage
f42ed819 4:man manual: User Commands
a7574d88
MB
5:man source: util-linux {release-version}
6:page-layout: base
7:command: runuser
8
9== NAME
10
11runuser - run a command with substitute user and group ID
12
13== SYNOPSIS
14
15*runuser* [options] *-u* _user_ [[--] _command_ [_argument_...]]
16
17*runuser* [options] [*-*] [_user_ [_argument_...]]
18
19== DESCRIPTION
20
21*runuser* can be used to run commands with a substitute user and group ID. If the option *-u* is not given, *runuser* falls back to *su*-compatible semantics and a shell is executed. The difference between the commands *runuser* and *su* is that *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 *runuser* does not have to be installed with set-user-ID permissions.
22
23If the PAM session is not required, then the recommended solution is to use the *setpriv*(1) command.
24
25When called without arguments, *runuser* defaults to running an interactive shell as _root_.
26
27For backward compatibility, *runuser* defaults to not changing the current directory and to setting only the environment variables *HOME* and *SHELL* (plus *USER* and *LOGNAME* if the target _user_ is not root). This version of *runuser* uses PAM for session management.
28
29Note that *runuser* in all cases use PAM (pam_getenvlist()) to do the final environment modification. Command-line options such as *--login* and *--preserve-environment* affect the environment before it is modified by PAM.
30
be3acd23 31Since version 2.38 *runuser* resets process resource limits RLIMIT_NICE, RLIMIT_RTPRIO, RLIMIT_FSIZE, RLIMIT_AS and RLIMIT_NOFILE.
e5496191 32
a7574d88
MB
33== OPTIONS
34
35*-c*, *--command*=_command_::
62fde24f 36Pass _command_ to the shell with the *-c* option.
a7574d88
MB
37
38*-f*, *--fast*::
62fde24f 39Pass *-f* to the shell, which may or may not be useful, depending on the shell.
a7574d88
MB
40
41*-g*, *--group*=_group_::
62fde24f 42The primary group to be used. This option is allowed for the root user only.
a7574d88
MB
43
44*-G*, *--supp-group*=_group_::
62fde24f 45Specify 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 *--group* is not specified.
a7574d88
MB
46
47*-*, *-l*, *--login*::
62fde24f
MB
48Start the shell as a login shell with an environment similar to a real login:
49+
e08e3d58 50* clears all the environment variables except for *TERM* and variables specified by *--whitelist-environment*
62fde24f
MB
51* initializes the environment variables *HOME*, *SHELL*, *USER*, *LOGNAME*, and *PATH*
52* changes to the target user's home directory
53* sets argv[0] of the shell to '*-*' in order to make the shell a login shell
a7574d88
MB
54
55*-P*, *--pty*::
bd67ca44 56Create 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 *runuser* works as a proxy between the sessions (sync stdin and stdout).
62fde24f 57+
bd67ca44 58This 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.
a7574d88
MB
59
60*-m*, *-p*, *--preserve-environment*::
62fde24f 61Preserve the entire environment, i.e., do not set *HOME*, *SHELL*, *USER* or *LOGNAME*. The option is ignored if the option *--login* is specified.
a7574d88
MB
62
63*-s*, *--shell*=_shell_::
62fde24f
MB
64Run the specified _shell_ instead of the default. The shell to run is selected according to the following rules, in order:
65
66* the shell specified with *--shell*
67* the shell specified in the environment variable *SHELL* if the *--preserve-environment* option is used
68* the shell listed in the passwd entry of the target user
69* /bin/sh
70+
71If the target user has a restricted shell (i.e., not listed in _/etc/shells_), then the *--shell* option and the *SHELL* environment variables are ignored unless the calling user is root.
a7574d88
MB
72
73**--session-command=**__command__::
62fde24f 74Same as *-c*, but do not create a new session. (Discouraged.)
a7574d88
MB
75
76*-w*, *--whitelist-environment*=_list_::
62fde24f 77Don't reset the environment variables specified in the comma-separated _list_ when clearing the environment for *--login*. The whitelist is ignored for the environment variables *HOME*, *SHELL*, *USER*, *LOGNAME*, and *PATH*.
a7574d88 78
2b2d3172 79include::man-common/help-version.adoc[]
a7574d88
MB
80
81== CONFIG FILES
82
83*runuser* reads the _/etc/default/runuser_ and _/etc/login.defs_ configuration files. The following configuration items are relevant for *runuser*:
84
62fde24f 85*ENV_PATH* (string)::
a7574d88 86Defines the PATH environment variable for a regular user. The default value is _/usr/local/bin:/bin:/usr/bin_.
a7574d88 87
62fde24f
MB
88*ENV_ROOTPATH* (string)::
89*ENV_SUPATH* (string)::
a7574d88 90Defines the *PATH* environment variable for root. *ENV_SUPATH* takes precedence. The default value is _/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin_.
a7574d88 91
62fde24f 92*ALWAYS_SET_PATH* (boolean)::
e6743239 93If set to _yes_ and *--login* and *--preserve-environment* were not specified *runuser* initializes *PATH*.
a7574d88
MB
94
95The environment variable *PATH* may be different on systems where _/bin_ and _/sbin_ are merged into _/usr_; this variable is also affected by the *--login* command-line option and the PAM system setting (e.g., *pam_env*(8)).
96
97== EXIT STATUS
98
99*runuser* normally returns the exit status of the command it executed. If the command was killed by a signal, *runuser* returns the number of the signal plus 128.
100
101Exit status generated by *runuser* itself:
102
a7574d88 1031::
62fde24f 104Generic error before executing the requested command
a7574d88 105126::
62fde24f 106The requested command could not be executed
a7574d88 107127::
62fde24f
MB
108The requested command was not found
109
a7574d88
MB
110
111== FILES
112
113_/etc/pam.d/runuser_::
62fde24f 114default PAM configuration file
a7574d88
MB
115
116_/etc/pam.d/runuser-l_::
62fde24f 117PAM configuration file if *--login* is specified
a7574d88
MB
118
119_/etc/default/runuser_::
62fde24f 120runuser specific logindef config file
a7574d88
MB
121
122_/etc/login.defs_::
62fde24f 123global logindef config file
a7574d88
MB
124
125== HISTORY
126
127This *runuser* command was derived from coreutils' *su*, which was based on an implementation by David MacKenzie, and the Fedora *runuser* command by Dan Walsh.
128
129== SEE ALSO
130
131*setpriv*(1),
132*su*(1),
133*login.defs*(5),
134*shells*(5),
135*pam*(8)
136
625e9c61 137include::man-common/bugreports.adoc[]
a7574d88 138
625e9c61 139include::man-common/footer.adoc[]
a7574d88
MB
140
141ifdef::translation[]
625e9c61 142include::man-common/translation.adoc[]
a7574d88 143endif::[]