1

Using Exim - root user can send email from command line, but non root users can not.

$ mail -s "test" test@test.com </dev/null
Null message body; hope that's ok
[xxx@master1 /usr/home/xxx]$ 2015-03-31 17:06:34 [58856] 
cwd=/usr/home/xxx 3 args: send-mail -i test@test.com

Seeing this in /var/log/messages:

Mar 31 17:07:11 master1 exim[59400]: 2015-03-31 17:07:11 [59400] 1Ycxl1-000FS4-0T failed to write to main log: length=134 result=-1 errno=9 (Bad file descriptor)
Mar 31 17:07:11 master1 exim[59400]: write failed on panic log: length=125 result=-1 errno=9 (Bad file descriptor)
Mar 31 17:07:11 master1 exim[59409]: 2015-03-31 17:07:11 [59409] 1Ycxl1-000FSD-1F failed to write to main log: length=134 result=-1 errno=9 (Bad file descriptor)
Mar 31 17:07:11 master1 exim[59409]: write failed on panic log: length=125 result=-1 errno=9 (Bad file descriptor)

exim is a symlink - both symlink and actual binary permissions look like:

[xxx@master1 ~]$ ls -l `which exim`
lrwsr-xr-x  1 root  wheel  13 Aug  5  2013 /usr/local/sbin/exim -> exim-4.80.1-2
[xxx@master1 ~]$ ls -l /usr/local/sbin/exim-4.80.1-2
-rwsr-xr-x  1 root  wheel  983184 Aug  5  2013 /usr/local/sbin/exim-4.80.1-2

Have tried adding user xxx as trusted_users in exim config - made no difference

  • What is your operating system/ distribution, please? And are you using your distribution's binary package, or not? And if not, why not? Ok, answering my own question - /usr/local/sbin is clearly not a system installation. Use the packaged binary, and your problems will likely go away. – Faheem Mitha Mar 31 '15 at 15:45
  • For all we know, the question lacking this information, this could be FreeBSD, Faheem Mitha. (Certainly wheel and /usr/home hint at this.) On FreeBSD, that is where the packaged binary lives. – JdeBP Mar 31 '15 at 19:28
  • Indeed - it is FreeBSD 9.1-RELEASE-p4, and that is the distributions binary package – Vuade Apr 1 '15 at 6:47
  • Are you sure mail is invoking /usr/local/sbin/exim and not perhaps an old version in /usr/lib/sendmail or /usr/sbin/sendmail? – wurtel Apr 1 '15 at 10:21
  • @wurtel I actually intend to use mutt. When I run mutt, I can see it invokes sendmail -oem -oi, and immediately thereafter I see the exim message in /var/log/messages. (/usr/sbin/sendmail -> /usr/sbin/mailwrapper) – Vuade Apr 1 '15 at 12:02
1

Others have suggested to resolve this with

chmod 4755 /usr/sbin/exim

In this case both mail and mutt is invoking sendmail.

Problem resolved with:

chmod 4755 /usr/sbin/sendmail

Now messages are sent successfully, and /var/log/exim/mainlog is written to and reflect as such.

  • So you have /usr/sbin/sendmail and /usr/local/sbin/exim-4.80.1-2? So are you even running exim now to deliver your messages? – roaima Apr 2 '15 at 12:14
  • @roaima sorry for the noob question - but how do I tell? I assumed exim because of: 1- The fact that immediately after running a program like mail and mutt, exim writes to /var/log/messages 2- When root runs mutt/mail, messages are appended in /var/log/exim/mainlog, and 3 sudo ps aux | egrep 'exim|sendmail' yields only /usr/local/sbin/exim -bd -q30m (exim-4.80.1-2) – Vuade Apr 2 '15 at 13:16
  • What is result of ls -l /usr/sbin/sendmail? – roaima Apr 2 '15 at 13:25
  • 1
    A lot of this confusion in various comments is coming from the fact that people aren't aware of how this stuff works on FreeBSD. It is not like Linux operating systems. The BSDs use mailwrapper. And third-party stuff from ports goes in /usr/local. – JdeBP Apr 3 '15 at 11:11
  • @roaima to answer your question, as @JdeBP pointed out, /usr/sbin/sendmail is a symlink to /usr/sbin/mailwrapper. Initially I tried to chmod only the symlink with chmod -h, but in the end the plain chmod did the trick by updating the permissions of /usr/sbin/mailwrapper – Vuade Apr 3 '15 at 16:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.