LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (http://www.linuxquestions.org/questions/linux-general-1/)
-   -   How to make lp and lpr run as if I were root (http://www.linuxquestions.org/questions/linux-general-1/how-to-make-lp-and-lpr-run-as-if-i-were-root-949087/)

cmnorton 06-07-2012 04:13 PM

How to make lp and lpr run as if I were root
 
I'm running Ubuntu 10.04. If I or applications that use lp or lpr try to print, an Unauthorized error is received. I've posted the error on launchpad.

I'd like to know how to get lp and lpr to run as if I or the applications I'm running were root. lp and lpr run fine, if I preface them with sudo.

I've tried setuid with no luck.

What else can I try?

Thanks.

camorri 06-08-2012 12:37 PM

As root, or use sudo to chmod lp and lpr. The command would look like this.

chmod 777 /usr/bin/lp and do the same for lpr. You have to verify the path to the files, or change directory to the files.

cmnorton 06-08-2012 01:35 PM

Need lp and lpr to act as if root ran them
 
Your suggestion works, but applications can't do that running as me. I need these two commands to act as if root ran them. I've tried setuid and it does not work or I was (probably the reason) not setting
the uid bit correctly.

camorri 06-08-2012 01:56 PM

Quote:

but applications can't do that running as me.
What? once the permissions are set, they stay there. Apps don't have to change anything.

cmnorton 06-08-2012 03:07 PM

I can print as root, not as me
 
I can print as root. I want to set the permissions in such a way, that my using lp or lpr is as if I were logged in as root.

camorri 06-08-2012 04:09 PM

What groups does your use ID blong to? Open a konsole and run the command 'id youruser' ( without the quotes ) and post the results. You probably need to add yourself to the lp group, or what ever group ubuntu uses for printing.

cmnorton 06-08-2012 06:15 PM

Will try lp group
 
am already part of lpadmin, though.

Mike_P 06-11-2012 08:36 PM

Quote:

Originally Posted by cmnorton (Post 4698988)
I've tried setuid and it does not work or I was (probably the reason) not setting
the uid bit correctly.

Must be root to do this.

To make an application run as root for any user. For example type

Code:

sudo chmod 4777 path-to-file
When you run ls -l to view the file, the execute bit x for root is replaced by a letter s
-rwsrwxrwx

Also, check if lp and lpr are not symlinks to the actual program(s)

craigevil 06-12-2012 02:42 AM

do NOT I repeat do NOT chmow chown or in any other way change the file properties


Your user should be in lpadmin, lp, and scanner groups

Quote:

$ groups
craig lp cdrom floppy sudo audio dip video plugdev users netdev lpadmin powerdev scanner debian-tor
DebuggingPrintingProblems - Ubuntu Wiki - https://wiki.ubuntu.com/DebuggingPrintingProblems
Printers - Community Ubuntu Documentation - https://help.ubuntu.com/community/Printers
NetworkPrintingWithUbuntu - Community Ubuntu Documentation - https://help.ubuntu.com/community/Ne...tingWithUbuntu

cmnorton 06-12-2012 08:57 AM

Even with group privs, does not work
 
Thanks for answering. My Ubuntu system does not have a scanner group, but cnorton is in lp and lpadmin.
I still can't print a file at the command line.

Quote:

Originally Posted by craigevil (Post 4701213)
do NOT I repeat do NOT chmow chown or in any other way change the file properties


Your user should be in lpadmin, lp, and scanner groups



DebuggingPrintingProblems - Ubuntu Wiki - https://wiki.ubuntu.com/DebuggingPrintingProblems
Printers - Community Ubuntu Documentation - https://help.ubuntu.com/community/Printers
NetworkPrintingWithUbuntu - Community Ubuntu Documentation - https://help.ubuntu.com/community/Ne...tingWithUbuntu


cmnorton 06-12-2012 09:01 AM

Tried setting UID
 
Thanks for answering. lp and lpr are not symlinks. I tried setting the UID per your instructions, and I get the same error.
Quote:

Originally Posted by Mike_P (Post 4701054)
Must be root to do this.

To make an application run as root for any user. For example type

Code:

sudo chmod 4777 path-to-file
When you run ls -l to view the file, the execute bit x for root is replaced by a letter s
-rwsrwxrwx

Also, check if lp and lpr are not symlinks to the actual program(s)


camorri 06-12-2012 09:40 AM

With the printer plugged in to USB port, and turned on, please run this command, copy and paste the results here.

'ls -l /dev/usb/lp* /dev/bus/usb/*/*' run the command without the quotes, just what is between them.

cmnorton 06-12-2012 02:31 PM

No local printers
 
Thanks for responding. I've got network printers. One's an SMB. I'll gladly grab whatever you need an post it.
Quote:

Originally Posted by camorri (Post 4701496)
With the printer plugged in to USB port, and turned on, please run this command, copy and paste the results here.

'ls -l /dev/usb/lp* /dev/bus/usb/*/*' run the command without the quotes, just what is between them.



All times are GMT -5. The time now is 05:30 AM.