How does lpr decide on the user?

Maarten Litmaath maart at cs.vu.nl
Fri Oct 20 06:22:59 AEST 1989


jon at 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 at cs.vu.nl, mcsun!botter!maart



More information about the Comp.sys.sun mailing list