GNU Rush |
|
Restricted User Shell |
Sergey Poznyakoff |
rushwho
utility.The rushwho
utility displays a list of users who are
currently using rush
. The utility operates
on default Rush database, which is maintained if rush
runs in accounting mode (see Accounting and Forked Mode). The following
is a sample output from rushwho
:
Login Rule Start Time PID Command jeff sftp Sun 12:17 00:58:26 10673 bin/sftp-server
The information displayed is:
The login name of the user.
The tag of the rule he is served under (see tag).
Time when the rule began execution.
Duration of the session.
PID of the running command.
Command line being executed.
This format is a built-in default. It may be changed either by
setting the RUSHWHO_FORMAT
environment variable to the desired
format string, or by using --format command line option.
This section summarizes the command line options understood by
rushwho
utility.
Use string instead of the default format, described in
Rushwho. See Formats, for a detailed description of the
output format syntax. If string begins with a ‘@’, then
this character is removed from it, and the resulting string is
treated as the name of the file to read. The contents of this file is
the format string. The file is read literally, except that lines
beginning with ‘;’ are ignored (they can be used to introduce
comments). For example, rushwho --format=@formfile
reads
in the contents of the file named formfile.
Use database directory dir, instead of the default. By default, database files are located in /usr/local/var/rush.
Do not display header line.
Display program version.
Display a short help message.
Display a concise usage summary.
A format string controls the output of every record from GNU Rush accounting database. It may contain following four types of objects:
These are copied to the output verbatim.
An escape is a backslash (‘\\’), followed by a single character. It is interpreted as follows:
Escape | Output |
\a | Audible bell character (ASCII 7) |
\b | Backspace character (ASCII 8) |
\e | Escape character (ASCII 27) |
\f | Form-feed character (ASCII 12) |
\n | Newline character (ASCII 10) |
\r | Carriage return character (ASCII 13) |
\t | Horizontal tabulation character (ASCII 9) |
\v | Vertical tabulation character (ASCII 11) |
\\ | A single backslash (‘\’) |
\" | A double-quote. |
Any escape not listed in the table above results in its second character being output.
Strings are delimited by single or double quotes. Within a string escape sequences are interpreted as described above.
A format specification is a kind of function, which outputs a particular piece of information from the database record.
Each format specification starts with an opening brace and ends with a closing brace. The first word after the brace is the name of the format specification. Remaining words are positional arguments followed by keyword arguments. Both are optional. When specified, keyword arguments must follow positional ones. A keyword argument begins with a colon. For example:
(time)
A single format specification.
(time 10)
The same format specification with the output width limited to 10 characters.
(time 10 Duration)
The ‘time’ format specification, with the output width limited to 10 characters and ‘Duration’ as a header title.
(time 10 "Session Duration" :right :format %H:%M)
The same with two keyword arguments: ‘:right’ and ‘:format’. The latter takes the string ‘%H:%M’ as its argument. Notice the use of quoted string to preserve the whitespace.
A full list of format specifications follows.
Causes the newline character to be output. If the optional count is supplied, that many newlines will be printed
Advance to the next tab stop in the output stream. If optional num is present, then skip num tab stops. Each tab stop is eight characters long.
The following specifications output particular fields from the database record. They all take two positional arguments: width and title.
The first argument, width sets the maximum output
length for this specification. If the number of characters actually output
is less than the width, they will be padded with whitespace either to
the left or to the right, depending on the presence of the :right
keyword argument. If the number of characters is greater than
width, they will be truncated to fit. If width is
not given, the field is output as is.
The second argument, title, gives the title of this column for the heading line. By default no title is output.
Every field specification accepts at least two keyword arguments.
The keyword :right
may be used to request alignment to the
right. This keyword is ignored if width is not given.
The keyword :empty
followed by a string instructs rushwho
to output that string if the resulting value for this specification
would otherwise be empty.
Print the user login name.
Date and time when the session started.
The :format
keyword introduces the strftime
format string
to be used when converting the date for printing. The default value is
‘%a %H:%M’. See Time and Date Formats, for a detailed
description of strftime
format strings.
Time when the command finished. This specifier is meaningful only for
rushlast
(see Rushlast). If the command is still
running, the word ‘running’ is output.
Total time of the session duration.
The tag of the rule used to serve the user. See tag, for a detailed description of rules and tags.
Command line being executed.
PID of the process.
For example, the following is the default format for the
rushwho
utility. It is written in a form suitable for use
in a file supplied with the --format=@file command
line option (see format option):
(user 10 Login)" " (rule 8 Rule)" " (start-time 0 Start)" " (duration 9 Time)" " (pid 10 PID)" " (command 28 Command)
This document was generated on January 2, 2022 using makeinfo.
Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved.