SYNOPSISnnacct -r [ -f file ] [ -a ] [ user ]...
nnacct [ -ppolicy ] [ -qquota ] user...
DESCRIPTIONThe nnacct command provides an optional accounting and access authorization for news reading via the nn news reader.
The first form (-r) is used to print accounting reports. If a file is specified data from a saved accounting file; otherwise the data is read from the current accounting file.
If -a is specified, the report will contain accounting data for
all users. Otherwise, if one or more users are specified,
the data for these users will be printed. If neiter is specified,
only the accounting data for the current user is printed.
Only the super-user can generate reports for other users than the caller.
The second form (-p and/or -q) assigns the specified access policy and/or quota to the specified users. If a given user is not already known in the accounting file, a new entry with the specified policy and quota is created (default values are used if both are not specified).
The third form (-ZERO) will clear the usage counts for all users. Individual usage counts cannot be cleared. The original accounting file is saved with a .old suffix.
The following policies are currently implemented:
- No access. The user is not allowed to read news at all.
- Privileged user. The user can read news at all times and no accounting information is saved. This is obviously the policy for system administrators :-)
- Full time access. The user can access news at all times.
- Off-hours access. The user can only access news at off hours, i.e. in the morning, in the evening, on week-ends, and on holidays (not complete - check the source :-)
The quota specifies a number of hours which the user is allowed to read news. When this quota is used up, access will be blocked. A quota of zero gives unlimited access.
New users will get the default policy and quota defined in account.c. If this allows new users to read news at only specific times, this form can be used to permit individual users to read news at all times, or it can be used to prevent them from reading news at all. If the default policy does not allow new users to read news, this form must be used to authorize them to read news.
HOW IT WORKSIf authorization is enabled, the nn news reader will call nnacct on start-up to check whether the policy and quota defined for the current user allows him to read news at this time (or at all).
If accounting is enabled, the nn news reader will call nnacct on exit to register the time spent on news reading. If account logging is also defined (see account.c), an line is also added to the accounting log file.
When accounting is defined, the user can use the :cost command to get the current accounting data, and if the variable report-cost is set, nn will print accounting information on exit.
CONTIGURATION AND NEW POLICIESThe use of nnacct is enabled via the ACCOUNTING and AUTHORIZE symbols in nn's configuration file. Further configuration of cost calculations, logging, default policy, default quotas, etc. is done directly in the source file account.c. New access policies can also be defined in this file. This allows you to change the policies or prices without having to recompile the whole package since only nnacct is modified.
PRIVILEGED USERSNormally, only root is allowed to change user policy or quota, list all user's accounting data etc. This privilege can be shared with other users by listing their login name in the file $CLIENT/admins. There should be exactly one login name per line, and no blanks are allowed.
FILES$db/acct accounting data (accumulated per user)
$db/acctlog accounting log (grows indefinitely)
$lib/admins login names of privileged nnacct users.
BUGSThere should be some tools to mess around with the accounting files, e.g. to make summaries, clear usage counters, etc.
AUTHORKim F. Storm, Texas Instruments A/S, Denmark
E-mail: [email protected]