1RUNUSER(1)                       User Commands                      RUNUSER(1)
2
3
4

NAME

6       runuser - run a command with substitute user and group ID
7

SYNOPSIS

9       runuser [options] -u user [[--] command [argument...]]
10
11       runuser [options] [-] [user [argument...]]
12

DESCRIPTION

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

OPTIONS

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                        and variables specified by --whitelist-environment
56
57                 o      initializes the  environment  variables  HOME,  SHELL,
58                        USER, LOGNAME, PATH
59
60                 o      changes to the target user's home directory
61
62                 o      sets  argv[0] of the shell to '-' in order to make the
63                        shell a login shell
64
65       -m, -p, --preserve-environment
66              Preserve the entire environment, i.e.  it  does  not  set  HOME,
67              SHELL,  USER  nor  LOGNAME.  The option is ignored if the option
68              --login is specified.
69
70       -s, --shell=shell
71              Run the specified shell instead of the default.   The  shell  to
72              run is selected according to the following rules, in order:
73
74                 o      the shell specified with --shell
75
76                 o      the  shell specified in the environment variable SHELL
77                        if the --preserve-environment option is used
78
79                 o      the shell listed in the passwd  entry  of  the  target
80                        user
81
82                 o      /bin/sh
83
84              If  the  target  user has a restricted shell (i.e. not listed in
85              /etc/shells) the --shell option and the SHELL environment  vari‐
86              ables are ignored unless the calling user is root.
87
88       --session-command=command
89              Same as -c , but do not create a new session.  (Discouraged.)
90
91       -w, --whitelist-environment=list
92              Don't  reset  environment variables specified in comma separated
93              list when clears  environment  for  --login.  The  whitelist  is
94              ignored  for  the  environment variables HOME, SHELL, USER, LOG‐
95              NAME, and PATH.
96
97       -V, --version
98              Display version information and exit.
99
100       -h, --help
101              Display help text and exit.
102

CONFIG FILES

104       runuser reads the /etc/default/runuser and  /etc/login.defs  configura‐
105       tion  files.   The  following  configuration  items  are  relevant  for
106       runuser:
107
108       ENV_PATH (string)
109           Defines the PATH environment variable  for  a  regular  user.   The
110           default value is /usr/local/bin:/bin:/usr/bin.
111
112       ENV_ROOTPATH (string)
113       ENV_SUPATH (string)
114           Defines  the  PATH environment variable for root. The default value
115           is /usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin.
116
117       ALWAYS_SET_PATH (boolean)
118           If set to yes and --login and --preserve-environment were not spec‐
119           ified runuser initializes PATH.
120
121       The  environment  variable  PATH may be different on systems where /bin
122       and /sbin are merged into /usr.
123

EXIT STATUS

125       runuser normally returns the exit status of the  command  it  executed.
126       If  the  command  was killed by a signal, runuser returns the number of
127       the signal plus 128.
128
129       Exit status generated by runuser itself:
130
131                 1      Generic error before executing the requested command
132
133                 126    The requested command could not be executed
134
135                 127    The requested command was not found
136

FILES

138       /etc/pam.d/runuser
139                        default PAM configuration file
140       /etc/pam.d/runuser-l
141                        PAM configuration file if --login is specified
142       /etc/default/runuser
143                        runuser specific logindef config file
144       /etc/login.defs  global logindef config file
145

SEE ALSO

147       setpriv(1), su(1), login.defs(5), shells(5), pam(8)
148

HISTORY

150       This  runuser command was derived from coreutils' su, which  was  based
151       on an implementation by David MacKenzie, and the Fedora runuser command
152       by Dan Walsh.
153

AVAILABILITY

155       The runuser command is part of the util-linux package and is  available
156       from Linux Kernel Archive ⟨https://www.kernel.org/pub/linux/utils/util-
157       linux/⟩.
158
159
160
161util-linux                         July 2014                        RUNUSER(1)
Impressum