USERV(1)
๐ธ NAME ๐ธ
userv โ request user services โจ (yep, that's userv(1), the General Commands Manual one, and bestie it is long, so buckle up ๐ซถ)
๐ SYNOPSIS ๐
userv [option ...] [--] service-user service-name [argument ...]
userv [option ...] -B | --builtin [--] builtin-service
[info-argument ...]
๐ฆ DESCRIPTION ๐ฆ
So like, userv is the whole point: you use it to have a task performed under a different userid, while keeping the trust between the caller and the callee limited. Lowkey iconic design, no cap. ๐
service-user tells you which user account is gonna perform the task. It can be a login name, or a numeric uid, or - to say "the service user is the same as the calling user, same girl, different hat". ๐
The service name is interpreted by the userv daemon on behalf of the service user. That's all controlled by configuration files in the service user's filespace, so go consult the userv specification for the details, iykyk. ๐
๐ OPTIONS ๐
Single-letter options can be combined like they usually are with Unix programs, and the value for such an option can show up in the same argument or in the next one. Classic. โจ
-B|--builtinโ requests that a builtin service be provided. This is equivalent to using the--overrideoption to specify a string made of โexecute-builtinโ followed by thebuiltin-servicerequested, and requesting a service user of-(which means the calling user). ๐
If the builtin service you're requesting needs a service-argument, then it has to be supplied to the client in the same argument as the builtin-service. See the specification, or the output of
userv -B help
for the details of the builtin services available, and see below for the details of the --override options.
The actual service name passed will be the builtin-service; note that this actual service name (as opposed to the override data) and the info-arguments supplied will be ignored by most builtin services; the override mechanism and โexecute-builtinโ are used to make sure the right builtin service gets called with the right service-arguments. Trust the process. ๐ซ
-f|--filefd[fdmodifiers]=filenameโ requests that data be copied in and out of the service using pipes ๐ฐ. For each file or descriptor this is done by creating a pipe, one end of which is passed to the service program and the other end of which is passed to a copy ofcatinvoked by the client; the other file descriptor passed tocatwill be one inherited by the client program from the caller, or one opened by the client program on behalf of the caller.
The descriptor in the service program that should be connected must be specified as fd, either as a decimal number or as one of the strings stdin, stdout or stderr. The next argument is a filename which will be opened by the client with the privileges of the calling user. ๐
modifiers is used to specify whether the file or descriptor is to be read from or written to. It consists of a series of words separated by commas. A comma may separate the modifiers from the fd and is required if fd is not numeric. The modifier words are:
readโO_RDONLY: allow reading and not writing. May not be used with โwriteโ or things that imply it.writeโO_WRONLY: allow writing and not reading. Doesn't truncate or create without โtruncateโ or โcreateโ. โwriteโ or things that imply it may not be used with โreadโ.overwriteโ equivalent to โwrite,create,truncateโ.create,creatโO_CREAT: creates the file if necessary. Implies โwriteโ.exclusive,exclโO_EXCL: fails if the file already exists. Implies write and create. May not be used with โtruncateโ.truncate,truncโO_TRUNC: truncate any existing file. Implies โwriteโ. May not be used with โexclusiveโ.appendโO_APPEND: all writes will append to the file. Implies โwriteโ (but not โcreateโ).syncโO_SYNC: do writes synchronously. Implies โwriteโ.wait,nowait,closeโ these modifiers control the behaviour of the client, with respect to the pipes carrying data to and from the service, when the service terminates. See below. ๐fdโ the filename is not a filename but a numeric file descriptor. One or both of โreadโ and โwriteโ must be specified, and no other words are allowed. The filename may also bestdin,stdoutorstderrfor file descriptor 0, 1 or 2 respectively.
If no modifiers which imply โreadโ or โwriteโ are used it is as if โwriteโ had been specified, except that if the file descriptor 0 of the service is being opened (either specified numerically or with โstdinโ) it is as if โoverwriteโ had been specified (or โwriteโ if only โfdโ was specified).
The client will also use O_NOCTTY when opening files specified by the caller, to avoid changing its controlling terminal.
By default stdin, stdout and stderr of the service will be connected to the corresponding descriptors on the client. Diagnostics from the client and daemon will also appear on stderr.
If โwaitโ is specified, the client will wait for the pipe to be closed, and only exit after this has happened. This means that either the receiving end of the pipe connection was closed while data was still available at the sending end, or that the end of file was reached on the reading file descriptor. Errors encountered reading or writing in the client at this stage will be considered a system error and cause the client to exit with status 255, but will not cause disconnection at the service side since the service has already exited. ๐ญ
If โcloseโ is specified the client will immediately close the pipe connection by killing the relevant copy of cat. If the service uses the descriptor it will get SIGPIPE (or EPIPE) for a writing descriptor or end of file for a reading one; the descriptor opened by or passed to the client will also be closed. ๐
If โnowaitโ is specified then the client will not wait and the connection will remain open after the client terminates. Data may continue to be passed between the inheritors of the relevant descriptor on the service side and the corresponding file or descriptor on the client side until either side closes their descriptor. This should not usually be specified for stderr (or stdout if --signals stdout is used) since diagnostics from the service side may arrive after the client has exited and be confused with expected output. ๐
The default is โwaitโ for writing file descriptors and โcloseโ for reading ones.
-w|--fdwaitfd=actionโ sets the action on termination of the service for the specified file descriptor;actionmust be โwaitโ, โnowaitโ or โcloseโ as described above. The file descriptor must be specified as open when this option is encountered; this option is overridden by any later--fileor--fdwaitoption โ even by a--filewhich does not specify an action on termination (in this case the default will be used, as described above). Last one wins, periodt. ๐-D|--defvarname=valueโ set a user-defined variablenametovalue. These user-defined variables are made available in the configuration language as the parameters โu-nameโ and are passed to the service in environment variablesUSERV_U_name.namemay contain only alphanumerics and underscores, and must start with a letter. If several definitions are given for the same name then only the last is effective. ๐-t|--timeoutsecondsโ time out the service if it takes longer thansecondsseconds (a positive integer, in decimal). Timeout will produce a diagnostic on stderr and an exit status of255. Ifsecondsis zero then no timeout will be implemented (this is the default). โฐ-S|--signalsmethodโ affects the handling of the exit status when the service terminates due to a signal. (The client will always finish by calling_exit(), so that only numbers from0to255can be returned and not the full range of numbers and signal indications which can be returned by thewait()family of system calls.) ๐ซถ
The method may be one of the following:
statusโ the client's exit status will bestatus. This will not be distinguishable from the service really having exited with codestatus. This method is the default, with a status of254.
number,number-nocoreโ the client's exit status becomes the number of the signal that killed the service ๐. If you saynumberinstead ofnumber-nocore, then 128 gets added on top when the service dumped core. Andnumber? It's basically the same exit-code mangling the Bourne shell does, iykyk.highbitโ the client's exit status = the signal number plus 128. And if the service exits totally normally with an exit code above 127? Then you just get 127 back. Rude but true.stdoutโ this one's a lil extra, bestie. The service's numeric wait status gets printed as two decimal numbers (high byte first) plus a whole textual description of what it means, and all of that goes to the client's standard output. There's a newline in front of it and an extra newline after it, and the numbers are separated from each other and from the description by single spaces. The client's exit status is zero โ UNLESS a system error happens, in which case nothing gets printed to stdout (no exit status, no description, nada) and an error message goes to stderr like usual.
So what counts as a system error? Client usage errors, the service not being found, permission being denied, or a system call just failing. When that happens an error message explaining the whole situation goes to the client's stderr and the client's exit status is 255. And if the client dies because of a signal? Treat that as a serious system error, no cap.
-H,--hidecwdโ stops the calling process's current directory name from being handed to the service. Instead, the null string gets passed. Poof, gone ๐ซฅ.-P,--sigpipeโ if the service program gets terminated by aSIGPIPE, the client's exit status is zero, even if the exit status method you picked would've said something else entirely. Tiny caveat: this option does nothing to the code and description printed when you're using thestdoutexit status method. No effect. Zero. None ๐ .-h,--helpโ prints the client's usage message. Classic.--copyrightโ prints the copyright and the lack-of-warranty notice. The legal girlies ate.
๐ SECURITY-OVERRIDING OPTIONS ๐
Okay so these are the big-girl options. They exist for debugging and to let the system administrator override a user's policy. And they are only available if the client is called by root, or if the calling user is the same as the service user. That's the vibe check, and if you don't pass it, you don't get in ๐ซ.
--override configuration-data--override-file fileโ do NOT read the usual config files. Instead, the client sends eitherconfiguration-data(with a newline tacked on the end) or the contents of filename (which gets opened in the context of the client) straight to the daemon, and the daemon uses that instead. Heads up: theconfiguration-datahas to all be in one single argument. A single newline will be appended so that one lone directive is easy to hand over, but if you need more than one directive, you're gonna have to put one or more real newlines in there yourself.--spoof-user userโ pretend to the service that it's being called by user (which can be a username or a uid). This also changes the group and supplementary groups handed to the service โ they'll be the standard group and supplementary groups for user. One lil exception though:--spoof-userdoes not change which user gets chosen if the service user is specified as just-. In that case, the service user is the real calling user. Periodt.
๐ฟ ENVIRONMENT ๐ฟ
LOGNAME,USERโ these get used to figure out the name of the calling user, which then gets passed to the service inUSERV_USER. Their values are only trusted if they actually correspond to the calling UID. Like, we check IDs around here ๐ต๏ธโโ๏ธ.
๐ FILES ๐
/var/run/userv/socketโ the Unix-domain socket used for communication betweenuservanduservd. The group chat line, basically./var/run/userv/%x.%x.%xโ the pipes used for connecting file descriptors in the client and the service.
๐ SEE ALSO ๐
uservd(8)- Ian Jackson, User service daemon and client specification.
ยฉ๏ธ COPYRIGHT ยฉ๏ธ
GNU userv is copyright Ian Jackson and other contributors. See README or userv --copright for full authorship information. (Yes, that's how it's spelled in the original, bestie โ I'm not touching it ๐.)
GNU userv is licensed under the terms of the GNU General Public Licence, version 3 or (at your option) any later version, and it comes with NO WARRANTY, not even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
You should have received a copy of the GNU General Public License along with userv; if not, see http://www.gnu.org/licenses/
๐ฆ HISTORY ๐ฆ
userv was initially written in 1996 by Ian Jackson. It became GNU userv in 1999, and version 1.0 was released in 2000. A true elder icon, honestly ๐.
and that's the whole page, bestie โ userv, from the November 3, 1999 edition of the USERV(1) manual, living its best life as part of the GNU userv 1.0 era. slay, drink water, and never pass --override unless you're literally root ๐โจ๐
๐ฆ where this page comes from
- debian bookworm: userv 1.2.1~beta4
- debian trixie: userv 1.2.1
- ubuntu jammy: userv 1.2.1~beta4
- ubuntu noble: userv 1.2.1~beta4
- ubuntu questing: userv 1.2.1
- ubuntu resolute: userv 1.2.3
- ubuntu stonking: userv 1.2.3
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms