[comp.unix.questions] Help with patching 'login'

cotner@brahms.berkeley.edu (Carl Cotner) (11/29/88)

I would like to implement a more detailed accounting system than what
UNIX offers.  Specifically, on the SUNs around here, I'd like a program
which prompts the user for a Job Number when he logs in.  Depending on
what task he'll be performing, he should supply an appropriate Job Number.
This JN is then recorded into a local accounting file for further
record-keeping.

I've seen this implemented before elsewhere; but on that machine, the 
operators bought UNIX source, so they were able to patch 'login' to query
for the JN and record it.  Now I'm dealing with SUNs in which the UNIX
OS came distributed in binary only, no source.  I don't know where to begin
to implement this.  Does anyone done this before?

Carl
cotner@brahms.Berkeley.EDU


ucbvax!brahms!cotner	           Carl Cotner/UCB Math Dept/Berkeley CA 94720

gandalf@csli.STANFORD.EDU (Juergen Wagner) (11/29/88)

In general, what keeps the user from supplying a job number indicating he/she
is going to work on project XYZ but then playing rogue? In particular, what do
you want to use the accounting for? If it is just a hint on user account usage,
I suggest to setup a daemon which listens on a AF_UNIX socket, and every user
should have something like
	echo -n "Gimme your job number?
	joblogger $<
and the program 'joblogger' will then record whatever info you need, this may
be used to change the job number in the middle of a login session (no problem
because the joblogger process may fetch the usage statistics of its parent).

If that's not what you need, short of patching login, how about a job number
suffix to user names. You may even have different passwords then. It will be
a different problem to ensure that the job numbers provided by users are 
accurate.

-- 
Juergen Wagner		   			gandalf@csli.stanford.edu
						 wagner@arisia.xerox.com