2 .\" This manpage is copyright, like the rest of userv, - see the
3 .\" copyright section, below.
9 .Nd request user services
23 .Op Ar info-argument ...
27 is used to have a task performed under different userid while
28 maintaining limited trust between caller and callee.
31 specifies which user account is to perform the task. The user may be
32 a login name or a numeric uid, or
34 to indicate that the service user is to be the same as the calling
37 The service name is interpreted by the userv daemon on behalf of the
38 service user. This is controlled by configuration files in the
39 service user's filespace; consult the userv specification for details.
41 Single-letter options may be combined as is usual with Unix programs,
42 and the value for such an option may appear in the same argument or in
46 Requests that a builtin service be provided. This is equivalent to
49 option to specify a string consisting of
53 requested, and requesting a service user of
55 (indicating the calling user).
57 If the builtin service being requested requires a
59 then this must be supplied to the client in the
62 See the specification, or the output of
63 .Bd -literal -offset indent -compact
66 for details of the builtin services available,
67 and below for details of the
71 The actual service name passed will be the
74 that this actual service name (as opposed to the override data) and
76 .Ar info-argument Ns s
77 supplied will be ignored by most builtin
78 services; the override mechanism and
81 used to ensure that the right builtin service is called with the right
82 .Ar service-argument Ns s .
86 .Ar fd Oo Ar fdmodifiers Oc = Ar filename
89 Requests that data be copied in and out of the service using pipes.
90 For each file or descriptor this will be done by creating a pipe, one
91 end of which is passed to the service program and the other end of
92 which is passed to a copy of
94 invoked by the client; the other file descriptor passed to
96 will be one inherited by the client program from the caller or one
97 opened by the client program on behalf of the caller.
99 The descriptor in the service program that should be connected must be
102 either as a decimal number or as one of the
108 The next argument is a filename which will be opened by the client
109 with the privileges of the calling user.
112 is used to specify whether the file or descriptor is to be read from
113 or written to. It consists of a series of words separated by commas.
114 A comma may separate the
122 The modifier words are:
126 Allow reading and not writing. May not be used with
128 or things that imply it.
131 Allow writing and not reading.
132 .Em Doesn't truncate or create
138 or things that imply it may not be used with
142 .Ql write,create,truncate .
143 .It Ic create , creat
145 Creates the file if necessary. Implies
147 .It Ic exclusive , excl
149 Fails if the file already exists. Implies write and create. May
152 .It Ic truncate , trunc
154 Truncate any existing file. Implies
160 All writes will append to the file. Implies
166 Do writes synchronously. Implies
168 .It Ic wait , nowait , close
169 These modifiers control the behaviour of the client, with respect to
170 the pipes carrying data to and from the service, when the service
171 terminates. See below.
175 is not a filename but a numeric file descriptor.
180 must be specified, and no
181 other words are allowed. The
188 for file descriptor 0, 1 or 2 respectively.
199 had been specified, except that if the filedescriptor 0 of the service
200 is being opened (either specified numerically or with
204 had been specified (or
210 The client will also use
212 when opening files specified by the caller, to avoid changing its
213 controlling terminal.
220 of the service will be connected to the corresponding descriptors on
221 the client. Diagnostics from the client and daemon will also appear
227 is specified, the client will wait for the pipe to be closed, and only
228 exit after this has happened. This means that either the receiving
229 end of the pipe connection was closed while data was still available
230 at the sending end, or that the end of file was reached on the reading
231 file descriptor. Errors encountered reading or writing in the client
232 at this stage will be considered a system error and cause the client
233 to exit with status 255, but will not cause disconnection at the
234 service side since the service has already exited.
238 is specified the client will immediately close the pipe connection by
239 killing the relevant copy of
241 If the service uses the descriptor it will get
245 for a writing descriptor or end of file for a reading one; the
246 descriptor opened by or passed to the client will also be closed.
250 is specified then the client will not wait and the
251 connection will remain open after the client terminates. Data may
252 continue to be passed between the inheritors of the relevant
253 descriptor on the service side and the corresponding file or
254 descriptor on the client side until either side closes their
255 descriptor. This should not usually be specified for
260 .Ql "--signals stdout"
261 is used) since diagnostics from the service side may arrive after the
262 client has exited and be confused with expected output.
266 for writing file descriptors and
271 .Ar fd Ns = Ns Ar action
273 Sets the action on termination of the service for the specified file
281 as described above. The file descriptor must be specified as open
282 when this option is encountered; this option is overridden by any
289 which does not specify an action on termination (in this case the
290 default will be used, as described above).
293 .Ar name Ns = Ns Ar value
295 Set a user-defined variable
300 user-defined variables are made available in the configuration
301 language as the parameters
303 and are passed to the
304 service in environment variables
305 .Ev USERV_U_ Ns Ar name .
307 may contain only alphanumerics and underscores, and must start with a
308 letter. If several definitions are given for the same
310 then only the last is effective.
311 .It Fl t | -timeout Ar seconds
312 Time out the service if it takes longer than
314 seconds (a positive integer, in decimal). Timeout will produce a
315 diagnostic on stderr and an exit status of 255. If
317 is zero then no timeout will be implemented (this is the default).
318 .It Fl S | -signals Ar method
319 Affects the handling of the exit status when the service terminates
320 due to a signal. (The client will always finish by calling
322 so that only numbers from 0 to 255 can be returned and not the full
323 range of numbers and signal indications which can be returned by the
325 family of system calls.)
329 may be one of the following:
332 The client's exit status will be
334 This will not be distinguishable from the service really having exited
337 This method is the default, with a
340 .It Ic number , number-nocore
341 The client's exit status will be the number of the signal which caused
342 the termination of the service. If
346 then 128 will be added if the service dumped core.
348 is very like the exit code mangling done by the Bourne shell.
350 The client's exit status will be the number of the signal with 128
351 added. If the service exits normally with an exit code of greater
352 than 127 then 127 will be returned.
354 The service's numeric wait status as two decimal numbers (high byte
355 first) and a textual description of its meaning will be printed to the
356 client's standard output. It will be preceded by a newline and
357 followed by an extra newline, and the numbers are separated from each
358 other and from the textual description by single spaces. The exit
359 status of the client will be zero, unless a system error occurs in
360 which case no exit status and description will be printed to
362 and an error message will be printed to
366 Problems such as client usage errors, the service not being found or
367 permission being denied or failure of a system call are system errors.
368 An error message describing the problem will be printed on the
371 and the client's exit status will be 255. If the client dies due to a
372 signal this should be treated as a serious system error.
375 Prevents the calling process's current directory name from being
376 passed to the service; the null string will be passed instead.
378 If the service program is terminated due to a
380 the exit status of the client will be zero, even if it would have been
381 something else according to the exit status method specified. This
382 option has no effect on the code and description printed if the exit
387 Prints the client's usage message.
389 Prints the copyright and lack of warranty notice.
391 .Sh SECURITY-OVERRIDING OPTIONS
392 There are also some options which are available for debugging and to
393 allow the system administrator to override a user's policy. These
394 options are available only if the client is called by root or if the
395 calling user is the same as the service user.
397 .It Fl -override Ar configuration-data
398 .It Fl -override-file Ar file
399 Do not read the usual configuration files. Instead, the client sends
400 .Ar configuration-data
401 (followed by a newline) or the contents of
403 (which is opened in the context of the client) to the daemon and the
404 daemon uses that data instead. The
405 .Ar configuration-data
406 must all be in one argument. It will have a single newline appended
407 so that a single directive can easily be given, but if more than one
408 directive is required it will have to contain one or more real
410 .It Fl -spoof-user Ar user
411 Pretend to the service that it is being called by
413 (which may be a username or a uid). This will also affect the group
414 and supplementary groups supplied to the service; they will be the
415 standard group and supplementary groups for
421 affect which user is chosen if the service user is specified as just
423 in this case the service user will be the real calling user.
427 .It Ev LOGNAME , USER
428 These are used to determine the name of the calling user, to be passed
431 Their values will only be used if they correspond to the calling UID.
435 .It Pa /var/run/userv/socket
437 socket used for communication between
441 .It Pa /var/run/userv/%x.%x.%x
442 Pipes used for connecting file descriptors in the client and the
448 .%T "User service daemon and client specification"
452 GNU userv is Copyright 1996-2017 Ian Jackson; Copyright 2000 Ben
453 Harris; and Copyright 2016-2017 Peter Benie.
455 GNU userv is licensed under the terms of the GNU General Public
456 Licence, version 3 or (at your option) any later version, and it comes
457 with NO WARRANTY, not even the implied warranty of MERCHANTABILITY or
458 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
461 You should have received a copy of the GNU General Public License
462 along with userv, if not, see http://www.gnu.org/licenses/
465 was initially written in 1996 by Ian Jackson. It became
468 in 1999, and version 1.0 was released in 2000.