System Administration
cancel
Showing results for 
Search instead for 
Did you mean: 

send mail issue on linux server

 
Highlighted
Regular Advisor

send mail issue on linux server

Hi All,

when i tried to execute the below command,i am getting the following error .
[peter@testserver /]$ mail -s "test" help@apc.com
Bad address

This command is working fine for root user.I am facing "bad address" problem for normal user only.

Regards,
Suresh
8 REPLIES 8
Highlighted
Honored Contributor

Re: send mail issue on linux server

Sounds like your DNS resolver is using different settings when used by root.

The most likely cause is that the permissions of one of the DNS resolver configuration files are set so that only root can read it. In this case, the regular users fall back to factory defaults and get a non-working result. Root can read anything, so root gets the correct DNS settings.

Check the permissions of /etc/resolv.conf, /etc/nsswitch.conf and /etc/hosts: all three should be readable by everyone on the system, but writeable only by root, i.e. -rw-r--r--.

Also check the permissions of the / and /etc directories: "ls -ld / /etc". The directories should be owned by root, and permissions should be drwxr-xr-x, i.e. writeable by root only, but readable and accessible by everyone.

MK
MK
Highlighted
Exalted Contributor

Re: send mail issue on linux server

Shalom,

Most corporate environments do not permit direct send of sendmail on port 25.

Normally you need to at least set the DS directive in sendmail.cf to get mail out the door.

But if the command is working for root and not other users, there may be a permissions problem on the binary.

Also please check /var/log/maillog

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Highlighted
Regular Advisor

Re: send mail issue on linux server

Hi,

Permission ok in our setup.Still iam facing the same issue.

Pls give me any suggesion ....


Regards,
Suresh
Highlighted
Honored Contributor

Re: send mail issue on linux server

let's try from the start - please run

host -t mx apc.com

command from root and regular user and send us the output.

Rgds,
vitaly
Highlighted
Regular Advisor

Re: send mail issue on linux server

Hi Vitaly,

Sorry for the delay.

Pls find the outputs ...

Root:
host -t mx apc.com
apc.com mail is handled by 10 mailrelay.apc.com.

Normal user:
host -t mx apc.com
apc.com mail is handled by 10 mailrelay.apc.com.

Regards,
Suresh

Highlighted
Honored Contributor

Re: send mail issue on linux server

let's try "host mailrelay.apc.com" from both users.

and another thing - I believe you have something relevant into /var/log/maillog
Highlighted
Regular Advisor

Re: send mail issue on linux server

Hi

Pls find the outputs and log file.

Root:
[root@king log]# host mailrelay.apc.com
mailrelay.apc.com has address 10.1.22.5

Normal User:
[suresh@king log]# host mailrelay.apc.com
mailrelay.apc.com has address 10.1.22.5

Log file:
Feb 19 08:40:40 king sendmail[2697]: n1FC4mZl018921: to=root, delay=3+07:50:44
, xdelay=00:00:00, mailer=local, pri=6697082, dsn=4.0.0, stat=Deferred: local ma
iler (/usr/bin/procmail) exited with EX_TEMPFAIL
Feb 19 08:40:41 king sendmail[13306]: n1GM4nvR019595: forward /root/.forward:
Group writable directory
Feb 19 08:40:41 king sendmail[20729]: n1DM4lJw026995: forward /root/.forward.king: Group writable directory
Feb 19 08:40:41 king sendmail[24019]: n1IE4pt4009108: to=root, delay=03:02:57,
xdelay=00:00:00, mailer=local, pri=445612, dsn=4.0.0, stat=Deferred: local mail
er (/usr/bin/procmail) exited with EX_TEMPFAIL
Feb 19 08:40:42 king sendmail[29895]: n1DG4k23005059: forward /root/.forward:
Group writable directory
Feb 19 08:40:42 king sendmail[24426]: n1EF4lbO025972: forward /root/.forward.king: Group writable directory
Feb 19 08:40:43 king sendmail[31629]: n1F64mIv027755: forward /root/.forward:
Group writable directory
Feb 19 08:40:43 king sendmail[12958]: n1E14lGd005082: forward /root/.forward.king: Group writable directory
Feb 19 08:40:43 king sendmail[5148]: n1HF4oL4020445: forward /root/.forward: G
roup writable directory


Regards,
Suresh
Highlighted
Honored Contributor

Re: send mail issue on linux server

The log file you sent is from testserver or "apc.com"?

I don't see something relevant for your problem, but I suggest to fix /root ornership anyway - it should be

chown 700 /root