Solved

Sendmail Auto print email using LPR not working

Posted on 2008-06-24
15
463 Views
Last Modified: 2013-12-17
I'm trying to setup my Linux machine to forward email to a printer.
While I found some posts describing what to do, I'm still having an issue locally with the sendmail.

I setup the local LPD service on the linux machine with a default queue named myQueue
I modified the aliases file of my sendmail  with the following line:

printout@mydomain: "|/usr/bin/lpr myQueue"

and I rebuilt the aliases

when I send an email to printout@mydomain
I get :

Jun 24 19:36:27 myServer sendmail[23417]: m5P2aRuZ023416: to=|/usr/bin/lpr myQueue, ctladdr=<printout@mydomain> (8/0), delay=00:00:00, xdelay=00:00:00, mailer=prog, pri=36493, dsn=5.0.0, stat=Service unavailable
Jun 24 19:36:27 myServer sendmail[23417]: m5P2aRuZ023416: m5P2aRuZ023417: DSN: Service unavailable


Can you help, I beleive I'm missing simple on that one
0
Comment
Question by:ageoffron
  • 8
  • 7
15 Comments
 
LVL 28

Expert Comment

by:Jan Springer
ID: 21867830
Is myQueue the name that you gave the printer in the printer configuration?

if so:

printout@mydomain: "|/usr/bin/lpr -p myQueue"

you can test the command manually first by:

cat filename.txt | /usr/bin/lpr -p myQueue
0
 

Author Comment

by:ageoffron
ID: 21867904
hi Jesper,

cat test.txt | /usr/bin/lpr -P myQueue
(Note Upper case P)
Does work from the command line, however I tried to modify the aliases and it still give sme the same error

Error: Jun 25 10:35:45 myServer sendmail[5928]: m5PHZjuZ005927: m5PHZjuZ005928: DSN: Service unavailable


0
 
LVL 28

Expert Comment

by:Jan Springer
ID: 21868124
Sorry, my bad on the typo and the recommendation.

Try this:

printout:           |/usr/bin/lpr - P myQueue

I don't know that the quotes are required once it hits the pipe.
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

Author Comment

by:ageoffron
ID: 21868201
I applied the change
printout@mydomain:  |/usr/bin/lpr - P myQueue

I also tried
printout@mydomain:  "|/usr/bin/lpr - P myQueue"
printout@mydomain:  "|/usr/bin/lpr - P myQueue
printout:  |/usr/bin/lpr - P myQueue

and no luck
Do I have anything to do to "allow" LPR with sendmail , like an option within the sendmail.mc file maybe? I looked but did not find anything...


For info,
I have other queues setup on that system which work... they are directed to a binary but the same principle apply.
helpdesk.xxx@mydomain: "|/etc/smrsh/cerberus-2.557.Linux-2.2.14-5.0 /etc/smrsh/config.xml F
ATAL /var/log/cerberus/cerberus.log

Still same error
0
 
LVL 28

Expert Comment

by:Jan Springer
ID: 21868320
You have these setup in sendmail aliases?

What are the permissions and ownership on the queues that work vs the one that doesn't?
0
 

Author Comment

by:ageoffron
ID: 21868399
Yes this the aliases from sendmail.

by permsission on the queue, I can only think of the persmission assign to the executables (LPR versus cerberus-2.557.Linux-2.2.14-5.0)
and they both are owned by root. So no difference at that level..

Let me know if you are refering to any other permissions.
0
 
LVL 28

Expert Comment

by:Jan Springer
ID: 21868503
If /usr/bin/lpr is chmod 755 or 711it should work.

Dumb question:  did you run newaliases?
0
 

Author Comment

by:ageoffron
ID: 21868571
Here is the permission details:

[root@myServer etc]# ls -al /usr/bin/lpr
lrwxrwxrwx    1 root     root           23 Apr  6  2004 /usr/bin/lpr -> /etc/alternatives/print
[root@myServer etc]# ls -al /etc/alternatives/print
lrwxrwxrwx    1 root     root           18 Apr  6  2004 /etc/alternatives/print -> /usr/bin/lpr.LPRng

[root@myServer etc]# ls -al /etc/smrsh/cerberus-2.557.Linux-2.2.14-5.0
-rwxr-xr-x    1 root     root      2614554 Apr  7  2004 /etc/smrsh/cerberus-2.557.Linux-2.2.14-5.0
0
 

Author Comment

by:ageoffron
ID: 21868579
and yes I issue the command "newaliases" to rebuild the aliases db.
0
 

Author Comment

by:ageoffron
ID: 21868633
I'm raising the point value of this question.
while the pb seems simple , there is something no so obvious going on wiht my sendmail..
0
 
LVL 28

Expert Comment

by:Jan Springer
ID: 21868743
Are you not using cups to configure the printing service and, if so, do you have lpd running?
0
 
LVL 28

Expert Comment

by:Jan Springer
ID: 21868797
What are the perms of /usr/bin/lpr.LPRng?
Are you using smmsp?

Have you tried to use the program /usr/bin/lpr.LPRng in the aliases file (tho this shouldn't matter).
0
 

Author Comment

by:ageoffron
ID: 21868886
LPD is running. we tested the LPR -P myQueue and it worked..
I'm not using CUPS. just LPD and sendmail locally

I finally found the issue, in my sendmail.mc I had:

FEATURE(`smrsh',`/usr/sbin/smrsh')dnl
A feature which restrict the binaires called through piping from sendmail.

I copied the LPR binary into that folder.. and voila it worked.


0
 
LVL 28

Accepted Solution

by:
Jan Springer earned 500 total points
ID: 21869021
And which was why I asked about smmsp.
0
 

Author Closing Comment

by:ageoffron
ID: 31470436
Some directions were given which help me find the solultion.
0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
In this video we show how to create an Accepted Domain in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Mail Flow >> Ac…
In this video we show how to create a mailbox database in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Servers >> Data…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question