Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place! |
| Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
04-01-2008, 04:59 AM
|
#1
|
|
LQ Newbie
Registered: Mar 2008
Posts: 15
Rep:
|
Sendmail Aliases
Hi,
I am configuring Sendmail Aliases to let system run a script after receiving a mail.
But it seems not working, message re-direction is ok, here is the details:
root: another-user --- working
root: |/script --- not working
Anybody wants to help me? thank you.
Yang
|
|
|
|
04-01-2008, 05:37 AM
|
#2
|
|
Guru
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 10,364
|
Try i.e. use the quotation marks around the full path to the script you want to run and see if it works.
After editing /etc/mail/aliases, run "newaliases" and restart sendmail.
Regards
|
|
|
|
04-01-2008, 09:20 AM
|
#3
|
|
LQ Newbie
Registered: Mar 2008
Posts: 15
Original Poster
Rep:
|
Thank you.
Thank you Bathory.
I tried this, still not working.
Here is a part of my aliases file.
-------------------------------------------
# Person who should get root's mail
#root: marc
root: yangg
yangg: "|/tmp/run.sh:"
-------------------------------------------
Messages sent to root can be forwarded to yangg, but if you address yangg nothing happens, yangg cannot receive this message either.
script run.sh is very simple: touch /tmp/aliases.tst, that's it.
I really don't have idea.
If you need to view my sendmail.mc file, please let me know..
Thank you in advance.
Yang
|
|
|
|
04-01-2008, 09:47 AM
|
#4
|
|
Guru
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 10,364
|
Edit aliases and in the line:
remove the colon ":" at the end of the script name. The line should look like this:
Code:
yangg: "|/tmp/run.sh"
Also make sure that the script is executable:
Code:
chmod +x /tmp/run.sh
Regards
|
|
|
|
04-01-2008, 10:24 AM
|
#5
|
|
LQ Newbie
Registered: Mar 2008
Posts: 15
Original Poster
Rep:
|
Hi Bathory,
Excution permission has been granted to the script run.sh and the colon is also removed.
After that, I run newaliases, restart sendmail sucessfully. But ... no good.
Anything should I do with sendmail.mc or sendmail.cf?
Yang
Last edited by sunnyyang; 04-02-2008 at 12:51 AM.
|
|
|
|
04-02-2008, 01:56 AM
|
#6
|
|
Guru
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 10,364
|
Take a look at the log files /var/log/maillog, /var/log/messages or whatever other log files your distro uses to see if you find any clues why the aliases is not working.
What distro are you using btw?
I don't think you have to do anything with sendmail.mc or sendmail.cf, since normal usernames aliases work.
|
|
|
|
04-02-2008, 02:15 AM
|
#7
|
|
LQ Newbie
Registered: Mar 2008
Posts: 15
Original Poster
Rep:
|
Log analysis
Sendmail Log
------------------
1. Apr 2 15:06:03 ts3 sendmail[5687]: alias database /etc/aliases rebuilt by root
2. Apr 2 15:06:03 ts3 sendmail[5687]: /etc/aliases: 65 aliases, longest 14 bytes, 655 bytes total
3. Apr 2 15:06:14 ts3 sendmail[5707]: alias database /etc/aliases rebuilt by root
4. Apr 2 15:06:14 ts3 sendmail[5707]: /etc/aliases: 65 aliases, longest 14 bytes, 655 bytes total
5. Apr 2 15:06:14 ts3 sendmail[5719]: starting daemon (8.12.8): SMTP+queueing@01:00:00
6. Apr 2 15:06:14 ts3 sm-msp-queue[5728]: starting daemon (8.12.8): queueing@01:00:00
7. Apr 2 15:07:00 ts3 sendmail[5733]: m32770ow005733: from=root, size=78, class=0, nrcpts=1,
8. msgid=<200804020707.m32770ow005733@ts3.tp.edu.sg>, relay=root@localhost
9. Apr 2 15:07:00 ts3 sendmail[5735]: m32770Da005735: from=<root@ts3.tp.edu.sg>, size=351, class=0, nrcpts=1, msgid=<200804020707.m32770ow005733@ts3.tp.edu.sg>, proto=ESMTP, daemon=MTA, relay=localhost.localdomain [127.0.0.1]
10. Apr 2 15:07:00 ts3 sendmail[5733]: m32770ow005733: to=yangg, ctladdr=root (0/0), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30068, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (m32770Da005735 Message accepted for delivery)
11. Apr 2 15:07:00 ts3 smrsh: uid 8: attempt to use "run.sh" (stat failed)
12. Apr 2 15:07:00 ts3 sendmail[5736]: m32770Da005735: to="|/tmp/run.sh", ctladdr=<yangg@ts3.tp.edu.sg> (8/0), delay=00:00:00, xdelay=00:00:00, mailer=prog, pri=30564, dsn=5.0.0, stat=Service unavailable
13. Apr 2 15:07:00 ts3 sendmail[5736]: m32770Da005735: m32770Da005736: DSN: Service unavailable
14. Apr 2 15:07:00 ts3 sendmail[5736]: m32770Da005736: to=user1\t\t, delay=00:00:00, xdelay=00:00:00, mailer=local, pri=31588, dsn=2.0.0, stat=Sent
--------------------
Yes, normal aliases works. The Aliases seemed to be triggered, but failed in running the script. It looks like that statement "|/tmp/run.sh" was treated as an address instead of a command.
For our convinience to talk, I hereby numbered the log.
What is "Distro"? Basically, besides access file and aliases it's all default in Redhat9.
yang
Last edited by sunnyyang; 04-02-2008 at 02:21 AM.
|
|
|
|
04-02-2008, 03:32 AM
|
#8
|
|
Guru
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 10,364
|
Distro is the Linux distribution you use, so you've answered it's RH 9. Anyway looking at the logs smrsh looked suspicious, so doing a little googling, I found this.
So I guess you need either to create the symlink mentioned there, or disable smrsh, in that case you need to rebuild your sendmail.cf.
|
|
|
|
04-02-2008, 11:00 AM
|
#9
|
|
LQ Newbie
Registered: Mar 2008
Posts: 15
Original Poster
Rep:
|
Done!!
Hi Bathory,
It's done!
I created a link under /etc/smrsh pointing to my script according to the following information:
-----------------------------------------------------------------
To allow the procmail program /usr/bin/procmail, use the following commands:
[root@deep] /# cd /etc/smrsh
[root@deep ]/smrsh# ln -s /usr/bin/procmail procmail
This will allow the mail and procmail programs to be run from a user's .forward file or an aliases file which uses the program syntax.
-----------------------------------------------------------------
This information is from
http://www.faqs.org/docs/securing/chap22sec182.html
But I got to switch to this link exactly from the webpage you passed to me. You have been always on the right direction, expert!!
Thank you.
I pasted all these meant to share with other people may need this.
Thank you all.
Case closed.
Thank you again Bathory!! I hope I can help people like how I was helped.
Yang
|
|
|
|
04-02-2008, 01:50 PM
|
#10
|
|
Guru
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 10,364
|
You are welcome. I'm glad you've made it.
Regards
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 05:44 PM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|