1RUNUSER(1) User Commands RUNUSER(1)
2
3
4
6 runuser - run a command with substitute user and group ID
7
9 runuser [options] -u user [[--] command [argument...]]
10
11 runuser [options] [-] [user [argument...]]
12
14 runuser allows to run commands with a substitute user and group ID. If
15 the option -u is not given, it falls back to su-compatible semantics
16 and a shell is executed. The difference between the commands runuser
17 and su is that runuser does not ask for a password (because it may be
18 executed by the root user only) and it uses a different PAM configura‐
19 tion. The command runuser does not have to be installed with set-user-
20 ID permissions.
21
22 If the PAM session is not required then recommended solution is to use
23 setpriv(1) command.
24
25 When called without arguments, runuser defaults to running an interac‐
26 tive shell as root.
27
28 For backward compatibility, runuser defaults to not change the current
29 directory and to only set the environment variables HOME and SHELL
30 (plus USER and LOGNAME if the target user is not root). This version
31 of runuser uses PAM for session management.
32
34 -c, --command=command
35 Pass command to the shell with the -c option.
36
37 -f, --fast
38 Pass -f to the shell, which may or may not be useful depending
39 on the shell.
40
41 -g, --group=group
42 The primary group to be used. This option is allowed for the
43 root user only.
44
45 -G, --supp-group=group
46 Specify a supplemental group. This option is available to the
47 root user only. The first specified supplementary group is also
48 used as a primary group if the option --group is unspecified.
49
50 -, -l, --login
51 Start the shell as a login shell with an environment similar to
52 a real login:
53
54 o clears all the environment variables except for TERM
55
56 o initializes the environment variables HOME, SHELL,
57 USER, LOGNAME, PATH
58
59 o changes to the target user's home directory
60
61 o sets argv[0] of the shell to '-' in order to make the
62 shell a login shell
63
64 -m, -p, --preserve-environment
65 Preserve the entire environment, i.e. it does not set HOME,
66 SHELL, USER nor LOGNAME. The option is ignored if the option
67 --login is specified.
68
69 -s, --shell=shell
70 Run the specified shell instead of the default. The shell to
71 run is selected according to the following rules, in order:
72
73 o the shell specified with --shell
74
75 o the shell specified in the environment variable SHELL
76 if the --preserve-environment option is used
77
78 o the shell listed in the passwd entry of the target
79 user
80
81 o /bin/sh
82
83 If the target user has a restricted shell (i.e. not listed in
84 /etc/shells) the --shell option and the SHELL environment vari‐
85 ables are ignored unless the calling user is root.
86
87 --session-command=command
88 Same as -c , but do not create a new session. (Discouraged.)
89
90 -V, --version
91 Display version information and exit.
92
93 -h, --help
94 Display help text and exit.
95
97 runuser reads the /etc/default/runuser and /etc/login.defs configura‐
98 tion files. The following configuration items are relevant for
99 runuser:
100
101 ENV_PATH (string)
102 Defines the PATH environment variable for a regular user. The
103 default value is /usr/local/bin:/bin:/usr/bin.
104
105 ENV_ROOTPATH (string)
106 ENV_SUPATH (string)
107 Defines the PATH environment variable for root. The default value
108 is /usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin.
109
110 ALWAYS_SET_PATH (boolean)
111 If set to yes and --login and --preserve-environment were not spec‐
112 ified runuser initializes PATH.
113
115 runuser normally returns the exit status of the command it executed.
116 If the command was killed by a signal, runuser returns the number of
117 the signal plus 128.
118
119 Exit status generated by runuser itself:
120
121 1 Generic error before executing the requested command
122
123 126 The requested command could not be executed
124
125 127 The requested command was not found
126
128 /etc/pam.d/runuser
129 default PAM configuration file
130 /etc/pam.d/runuser-l
131 PAM configuration file if --login is specified
132 /etc/default/runuser
133 runuser specific logindef config file
134 /etc/login.defs global logindef config file
135
137 setpriv(1), su(1), login.defs(5), shells(5), pam(8)
138
140 This runuser command was derived from coreutils' su, which was based
141 on an implementation by David MacKenzie, and the Fedora runuser command
142 by Dan Walsh.
143
145 The runuser command is part of the util-linux package and is available
146 from Linux Kernel Archive ⟨https://www.kernel.org/pub/linux/utils/util-
147 linux/⟩.
148
149
150
151util-linux July 2014 RUNUSER(1)