Operating System - HP-UX
1752781 Members
5716 Online
108789 Solutions
New Discussion

Re: What is required to get lpadmin to run as a user other than root?

 
SkyeB
Advisor

What is required to get lpadmin to run as a user other than root?

HP-UX 11.31

I am trying to get lpadmin to run under a service account, so that I can add, and remove printers on a single system from a custom web interface.

How can I get lpadmin to run as "user1" ?

I have tried changing the permissions on lpadmin.

I have added user1 to the following groups: root, sys, bin, lp, adm - all to no avail

I have tried compiling a wrapper to set the euid, egid, uid, and gid, all to 0, but I still get an error message stating:

"lpadmin: this command for use only by LP Administrators"

How do I give permit lpadmin to be executed by user1?

Skye Bowen
Midrange Systems Analyst III
5 REPLIES 5
Stephan.
Honored Contributor

Re: What is required to get lpadmin to run as a user other than root?

Hi,

as you already found only root can run it - to enable normal user you can install sudo: http://hpux.connect.org.uk/hppd/hpux/Sysadmin/sudo-1.8.0/

 

hth,

Stephan

SkyeB
Advisor

Re: What is required to get lpadmin to run as a user other than root?

OK fair enough, but my wrapper has set the uid, euid, gid, egid bits all to 0. When I execute a shell using my wrapper, and execute a "who" it tells me that I am root.

What is lpadmin checking when it determines that I am not root?

I tried granting access to printers through "sam -r" and that did not work either

Skye Bowen
Midrange Systems Analyst III
Dennis Handly
Acclaimed Contributor

Re: What is required to get lpadmin to run as a user other than root?

>What is lpadmin checking when it determines that I am not root?

 

What are the permissions and owners of lpadmin?  Did you fiddle with them?

SkyeB
Advisor

Re: What is required to get lpadmin to run as a user other than root?

No, I did not fiddle with the binary:

 

(/usr/sbin)# ls -la lpadmin
-r-sr-xr-x   1 root       bin         158920 Jan 15  2009 lpadmin

Skye Bowen
Midrange Systems Analyst III
Denver Osborn
Honored Contributor

Re: What is required to get lpadmin to run as a user other than root?

Sounds like you're not setting the real uid as root and I believe lpadmin is looking at the reail uid. 

 

Are you using setresuid(2)?  

 

Here's my simple wrapper which I used to test successfully:

 

#include <stdio.h>

main()

{

   setresuid(0,0,0)

   system("/usr/sbin/lpadmin -s")

}

 

 

 

Hope this helps,

-denver