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