jon@astro.ucla.edu (Jonathan Eisenhamer) (10/12/89)
To All Spots, A simple question: How does lpr decide on who is going to be the owner of a printing job? In a program (see below), I change the real and effective uid of a process and then submit a print job. The "whoami" correctly shows the change in uid, but an lpq reveals that the print job started by lpr is owned by the uid who ran the program, not the uid changed in the program. This is on a Sun3 running 4.0.1. Any RTFM's or other pointers would be appreciated. Jonathan Eisenhamer jon@astro.ucla.edu jon@uclastro.bitnet bonnie::jon (span 5.708) (213)206-8596
maart@cs.vu.nl (Maarten Litmaath) (10/20/89)
jon@astro.ucla.edu (Jonathan Eisenhamer) writes:
\A simple question: How does lpr decide on who is going to be the owner of
\a printing job? [...]
If file descriptor 0, 1 or 2 refers to a tty, the owner of the job is the
person logged in on that tty, else it is the real uid... :-(
(Remember: lpr's effective uid is root.)
Work-around:
% cat mylpr
#!/bin/sh
exec 3>&1
test -t 0 && exec < /dev/null
(/usr/ucb/lpr ${1+"$@"} | cat >&3) 2>&1 | cat >&2
Now we're sure none of the mentioned file descriptors refers to a terminal.
A symbolic link is a POINTER to a file, | Maarten Litmaath @ VU Amsterdam:
a hard link is the file system's GOTO. | maart@cs.vu.nl, mcsun!botter!maart