Avatar of lisha
lisha
 asked on

Mailx command not working from one sudo ID

Few days back any mail related command ( mailx, mail ,mpack  ) stopped working from one sudo id .
in the logs i get error as dsn=5.6.0, stat=Data format error
but this happens with only one sudo ID-sudo1@my_hostname
another id -sudo2 works fine with any of the mail command

sudo su sudo1
mailx -s "Test mail" someone@example < /tmp/test.file
/home/sudo1/dead.letter... Saved message in /home/sudo1/dead.letter
where from=sudo1@my_hostname
message fails to sent


sudo su sudo2
mailx -s "Test mail" someone@example < /tmp/test.file
where from=sudo2@my_hostname
message successfully sent and received.

Not getting why with one prefix it is sent and other fails ... ?
System ProgrammingEmail ServersUnix OS

Avatar of undefined
Last Comment
lisha

8/22/2022 - Mon
Panagiotis Toumpaniaris

The mail server is on the same machine? Can you see in the logs (/var/log/mail*) if there are entries concerning this failure?
lisha

ASKER
yes they are on same machine ...
and i only found syslog ..in /var/log

cd /var/log
ls -l mail*
mail*: No such file or directory

ls -l sys*
syslog
syslog.0
syslog.1
syslog.2
syslog.3
syslog.4
syslog.5
syslog.6
syslog.7
Panagiotis Toumpaniaris

which mail server are you using? If you are using sendmail then you are right, the logs should be in syslog under the LOG_MAIL facility.
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
lisha

ASKER
yes we are using sendmail...
Jan Bacher

Perhaps it's not a sudo mailx issue but a sudo permission issue for that file in the tmp directory.
lisha

ASKER
the file has 777 permission on it ... we thought so initially ... but it did not work
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
Jan Bacher

Have you run strace?
lisha

ASKER
as i said earlier we were able to send the file using another sudo id .. sudo1 is not working but sudo2 is
Jan Bacher

I read what you said earlier and obviously this is broken otherwise you would have asked for help.  Have you run strace?
Your help has saved me hundreds of hours of internet surfing.
fblack61
lisha

ASKER
nope not able to run it as it gives error
strace mailx
 
ERROR: unable to open /dev/log

not having permission
but the log last update date was Mar  4  2014
lisha

ASKER
sorry (Jan Springer) if u felt i was rude earlier .... but i am exactly not getting what have happened ... as nothing has changed from our side
Jan Bacher

grep sudo1 /var/log/maillog*
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
lisha

ASKER
we have syslog ... since we use sendmail ... not maillog*... i could paste you the content of that if u like ...
Jan Bacher

Sendmail uses syslog and typically writes to maillog.

What is your OS?  What version?  Does it use selinux?
lisha

ASKER
my OS is sun solaris ... version SunOS 5.10
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
Jan Bacher

Try running that command with "truss" instead of "strace"
lisha

ASKER
ran the command with both sudo1 and sudo2 id for mpack
truss mpack ...
but no diff in any thing between the both id...
russ -c mpack
An input file must be specified
mpack version 1.5
usage: mpack [-s subj] [-d file] [-m maxsize] [-c content-type] file address...
       mpack [-s subj] [-d file] [-m maxsize] [-c content-type] -o file file
       mpack [-s subj] [-d file] [-m maxsize] [-c content-type] -n groups file
 
syscall               seconds   calls  errors
_exit                      .000       1
write                     .000       6
open                     .000       6       1
close                     .000       5
getpid                   .000       1
execve                  .000       1
sigfillset               .000       1
getcontext          .000       1
setustack            .000       1
mmap                 .000      26
munmap            .000       8
getrlimit              .000       1
memcntl             .000       6
sysinfo                .000       1
resolvepath        .000       7
stat64                   .001      18      12
fstat64                  .000       1
                     --------  ------   ----
sys totals:              .003      91     13
usr time:                .004
elapsed:                 .040
SOLUTION
Jan Bacher

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
arnold

More /etc/syslog.conf to see whether you are dumping mail.* to /dev/null
/var/adm/messages might contain mail related error, refer to syslog.conf

You might have restrictions mailx is a graphical,
Try
echo "To: somerecipient
From: sender
subject: test

This is a test" | /usr/lib/sendmail -oi -fsender_email -t

See what happens
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
lisha

ASKER
hey .. i tried using truss to check with mpack ...
the only diff that came is ..
/home/suod1 => truss mpack -s "`date '+%m%d%y'` TEST MAIL" -d /tmp/test_mail_msg1.txt -m 6000000 /tmp/test_mail_attach1.csv "someone@example.com"
    Manu(8:40:14 AM):execve("/usr/bin/mpack", 0xFFBFE794, 0xFFBFE7BC)  argc = 9
/home/suod2 => truss mpack -s "`date '+%m%d%y'` TEST MAIL" -d /tmp/test_mail_msg1.txt -m 6000000 /tmp/test_mail_attach1.csv "someone@example.com"
 execve("/usr/bin/mpack", 0xFFBFE794, 0xFFBFE7BC)  argc = 9

Manu is one of the users present in the server .. but does not have the sudo access ...
Jan Bacher

This is not copy/paste?
lisha

ASKER
yeah ... was a copy paste error ... now i see the first diff comes here..
stat64("/usr/bin/mpack", 0xFFBFE258) = 0
stat64("/usr/SUNWspro/lib//libsocket.so.1", 0xFFBFD9B8) Err#2 ENOENT
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
Jan Bacher

You probably need assistance with someone that's familiar with Solaris.   I'm sorry but the debug does not help me.
ASKER CERTIFIED SOLUTION
arnold

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
lisha

ASKER
thanks !! the mail was getting blocked as id was blocked... now the id is unblocked... everything seems to be fine ..