# lprm : permission denied



## mtdboy (Jan 11, 2012)

If I login as a (normal) user I can submit jobs to a print queue (lp) and cancel jobs (lprm). However, if I *su -* to the same user I can submit jobs but not cancel them. If I try to cancel a job I get "Permission denied". I tried sourcing .shrc, and also exporting HOST (since that wasn't set) but to no avail. Does anyone know if it's possible to do this?

I'm using FreeBSD 8.0-RELEASE-p4.


----------



## wblock@ (Jan 12, 2012)

Maybe it's using getuid(2) instead of geteuid(2).  There could be security reasons that.  Or maybe it has to do with permissions of the print queue.


----------



## fonz (Jan 12, 2012)

wblock@ said:
			
		

> Maybe it's using getuid(2) instead of geteuid(2).  There could be security reasons that.




```
[b]fonz@spectrum% grep uid /usr/src/usr.sbin/lpr/lprm/lprm.c[/b]
uid_t	 uid, euid;		/* real and effective user id's */
	uid = getuid();
	euid = geteuid();
	[red]seteuid(uid);	/* be safe */[/red]
	if (getuid() == 0) {
		if ((p = getpwuid(getuid())) == NULL)
```
Fonz

Edit: Looks like a security feature indeed.


----------

