lpr uid
David J. Camp
david at wubios.wustl.edu
Thu May 25 13:37:46 AEST 1989
I am using a Sun 3/260 running SunOS 4.0.1. Please reply directly to me
since I do not read this newsgroup.
Here is the problem. We have two kinds of accounts on wubios. There
are 'mail' accounts, which are personal accounts for each user to login,
and 'analysis' accounts, which can only be accessed via the 'su' command
once you are logged in. We accomplish this via a short C program called
nologin.c, which I have included below. This program is specified in
/etc/passwd as the shell for the analysis accounts.
Now we are interested in getting statistics on printer usage for the
various users. We are mostly interested in the mail account usage, not
the analysis account usage. That is, we would like printer usage while
using an analysis account to be charged to the user account. The actual
situation, however, is not consistent. When printing normal text, the
accounting is registered under the mail account. When we run Sun-Sas
and do a graphics printout, the accounting is registered under the
analysis account. This also affects the username that appears on the
header page of the printouts. We would like the header page to name the
mail account, not the analysis account. It in fact follows the same
pattern as the accounting, using the mail account for text and the
analysis account for graphics.
I have studied the 4.3BSD-tahoe code, which may not be the same as the
executables we get from Sun. It appears that lpr uses the getuid() call
to determine the user account. The 'man getuid' page says that getuid
returns the 'real' userid. The 'man su' page says that su changes both
the real and effective user id's. This suggests that the graphics job
is doing the correct thing, and the text mode printing is broken.
We would like it to work the other way around. We would like the mail
account to be listed on the printout, and registered for pac as the user
printing the mail.
We have not yet installed any of the 4.3BSD-tahoe code, since we are
sheepish about doing our own support when a later version of the
operating system may supercede all the changes we have made to
unsupported code. We do not have a SunOS source license.
We are interested in theories of why the graphics job, run from the Sas
system, works differently than a simple text printout. We are also
interested in proposals for changing the way it works, hopefully without
installing the tahoe code.
-David-
/* nologin.c -- program to prevent direct login */
#include <string.h>
main (argc, argv, envp)
int argc;
char * argv [];
char * envp [];
{
if (strcmp (getenv ("USER"), getenv ("LOGNAME")) == 0)
exit (2);
execve ("/bin/csh", argv, envp);
}
/*
Bitnet: david at wubios.wustl ^ Mr. David J. Camp
Internet: david%wubios at wucs1.wustl.edu < * > Box 8067, Biostatistics
uucp: uunet!wucs1!wubios!david v 660 South Euclid
Washington University (314) 36-23635 Saint Louis, MO 63110
*/
--
Bitnet: david at wubios.wustl ^ Mr. David J. Camp
Internet: david%wubios at wucs1.wustl.edu < * > Box 8067, Biostatistics
uucp: uunet!wucs1!wubios!david v 660 South Euclid
Washington University (314) 36-23635 Saint Louis, MO 63110
More information about the Comp.unix.questions
mailing list