# Sendmail Errors

## CobraNMU

Hey Everyone,

I think I have a weird one for all of ya. I'm trying to get the recieving part of sendmail working so I can act as a mail server too. Sendmail (sending) works fine. Just let me know what all you need to trouble shoot this one and I'll post it asap. Here's the error.

Jun  9 10:50:39 oecstaff sendmail[17820]: i59Eoddj017820: to=me@theserver.thedomain.edu, ctladdr=me (1005/100), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30050, relay=[127.0.0.1] [127.0.0.1], dsn=4.0.0, stat=Deferred: 421 4.3.0 collect: Cannot write ./dfi59Eod5H017821 (bfcommit, uid=209, gid=209): Permission denied  :Question: 

----------

## DaveArb

What permissions are on your /var/spool/mail directory?

From my working (non-Gentoo, but shouldn't matter?) Sendmail machine, rwx------, owned by root, group mail. Overly permissive permissions can give Sendmail as much problems as too restrictive.

Dave

----------

## CobraNMU

drwxrwxrwx  2 root mail 4096 Apr 10 01:40 .

drwxr-xr-x  8 root root 4096 Apr 10 21:47 ..

-rw-r--r--  1 root root    0 Apr 10 01:40 .keep

----------

## DaveArb

 *CobraNMU wrote:*   

> drwxrwxrwx  2 root mail 4096 Apr 10 01:40 .
> 
> drwxr-xr-x  8 root root 4096 Apr 10 21:47 ..
> 
> -rw-r--r--  1 root root    0 Apr 10 01:40 .keep

 

777 permissions is definitely a problem. `chmod 700 /var/spool/mail`, see if that cures the non-delivery.

Dave

----------

## papal_authority

Also check these directories in /var/spool too:

```

drwxrwxrwx    2 smmsp    mail          144 Jun  9 07:53 clientmqueue/

drwxrwxrwt    2 root     mail           96 Jun  9 07:54 mail/

drwxrwx---    2 root     mail          176 Jun  9 07:53 mqueue/

```

HTH.

----------

## CobraNMU

I changed those permissions and get this error when i check mail now...

/var/mail/rob: Permission denied

----------

## CobraNMU

total 32

drwxr-xr-x   8 root  root  4096 Apr 10 21:47 .

drwxr-xr-x  14 root  root  4096 Apr 16 14:22 ..

-rw-r--r--   1 root  root     0 Jun  4 13:11 .keep

drwxrwxrw-   2 smmsp smmsp 4096 Jun  9 11:16 clientmqueue

drwxr-x---   4 root  cron  4096 Apr 10 01:40 cron

drwx------   3 lp    root  4096 Apr 10 03:30 cups

drwx------   2 root  mail  4096 Apr 10 01:40 mail

drwxr--r--   2 root  root  4096 Jun  9 10:46 mqueue

drwxrwxrwt   2 root  root  4096 Apr 10 19:56 samba

----------

## DaveArb

 *CobraNMU wrote:*   

> I changed those permissions and get this error when i check mail now...
> 
> /var/mail/rob: Permission denied

 

You changed /var/mail instead of /var/spool/mail. Change /var/mail back to 777, change /var/spool/mail to 700.

My clientmqueue runs with more restrictive permissions than papal_authority's, so that's probably OK.

Dave

----------

## CobraNMU

Here's the error I get again

Jun  9 11:41:25 oecstaff sendmail[17955]: i59FfO7s017955: to=myname@myserver.mydomain.edu, ctladdr=root (0/0), delay=00:00:01, xdelay=00:00:01, mailer=relay, pri=30045, relay=[127.0.0.1] [127.0.0.1], dsn=4.0.0, stat=Deferred: 421 4.3.0 collect: Cannot write ./dfi59FfO5H017956 (bfcommit, uid=209, gid=209): Permission denied

here are the current Permissions:

ls -la /var/mail

drwxrwxr-x  2 root mail 4096 Apr 10 01:40 .

drwxr-xr-x  8 root root 4096 Apr 10 21:47 ..

-rw-r--r--  1 root root    0 Apr 10 01:40 .keep

ls -la /var/spool

drwxr-xr-x   8 root  root  4096 Apr 10 21:47 .

drwxr-xr-x  14 root  root  4096 Apr 16 14:22 ..

-rw-r--r--   1 root  root     0 Jun  4 13:11 .keep

drwxrwxrw-   2 smmsp smmsp 4096 Jun  9 11:41 clientmqueue

drwxr-x---   4 root  cron  4096 Apr 10 01:40 cron

drwx------   3 lp    root  4096 Apr 10 03:30 cups

drwxrwxr-x   2 root  mail  4096 Apr 10 01:40 mail

drwxr--r--   2 root  root  4096 Jun  9 10:46 mqueue

drwxrwxrwt   2 root  root  4096 Apr 10 19:56 samba

----------

## DaveArb

Ah, cripes! I'm running a Sendmail compiled from sendmail.org source, and the Gentoo portage package has moved things around! I apologize for previous misleading information, /var/spool/mail and /var/mail are linked on your system.

[edit]Naw, that ain't it either. I'm just an idiot, I wrote "mail" multiple times, when what I really meant all along was "mqueue".   :Embarassed:  Sorry for the run-around.

Here is the /var/spool directory of a Gentoo machine that has run properly in the past (it's a test machine):

```
drwxrwx---    2 smmsp    smmsp        4096 Apr 26 16:49 clientmqueue

drwxr-x---    4 root     cron         4096 Apr  5 13:43 cron

drwx------    3 lp       root         4096 May 25 15:49 cups

drwxrwxrwt    2 root     mail         4096 May 14 03:10 mail

drwx------    2 root     root         4096 May 14 03:10 mqueue

drwxrwxrwt    2 root     root         4096 May 25 16:49 samba
```

Note that mqueue is different than yours. Try that, Sendmail is very security sensitive on the settings for these directories.

Dave

----------

## CobraNMU

Same problem.

Jun  9 12:05:20 mycomputer sendmail[18034]: i59G5KiY018034: to=me@localhost, ctladdr=root (0/0), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30048, relay=[127.0.0.1] [127.0.0.1], dsn=4.0.0, stat=Deferred: 421 4.3.0 collect: Cannot write ./dfi59G5K5H018035 (bfcommit, uid=209, gid=209): Permission denied

----------

## DaveArb

Run

```
sendmail -v -bi
```

And see if it complains about directories with writable permissions. You'll need to be root to run this.

Dave

----------

## CobraNMU

can not chdir(/var/spool/mqueue/): Permission denied

Program mode requires special privileges, e.g., root or TrustedUser.

----------

## DaveArb

 *CobraNMU wrote:*   

> can not chdir(/var/spool/mqueue/): Permission denied
> 
> Program mode requires special privileges, e.g., root or TrustedUser.

 

You'll need to be root to run this.  :Question: 

Dave

----------

## CobraNMU

I am root when i run this...

mycomputer root # sendmail -v -bi

can not chdir(/var/spool/mqueue/): Permission denied

Program mode requires special privileges, e.g., root or TrustedUser.

----------

## DaveArb

Bizarre. What does

```
grep TrustedUser /etc/mail/*cf
```

report?

I might begin considering re-emerging Sendmail if I were in your position. The install seems pretty goofed. I recall that installation on Gentoo was just a matter of emerging, setting up sendmail.mc/compiling it, and running.

Dave

----------

## CobraNMU

Had to go to work for a bit.

Here's what that command gives me.

/etc/mail/sendmail.cf:#O TrustedUser=root

/etc/mail/submit.cf:O TrustedUser=smmsp

----------

## DaveArb

 *CobraNMU wrote:*   

> Had to go to work for a bit.

 

Happens to the best of us.   :Wink: 

 *CobraNMU wrote:*   

> /etc/mail/sendmail.cf:#O TrustedUser=root
> 
> 

 

On my system, that's not commented, and TrustedUser is smmsp (root being a bad choice). The .mc command for this is `define(`confTRUSTED_USER', `smmsp')dnl`

If not too long, would you mind posting your sendmail.mc? I think there could be some clues there. I have to do some work this afternoon too, but will try to check back later.

Dave

----------

## CobraNMU

divert(-1)

divert(0)dnl

include(`/usr/share/sendmail-cf/m4/cf.m4')dnl

VERSIONID(`$Id: sendmail-procmail.mc,v 1.1 2003/04/24 21:18:58 avenj Exp $')dnl

OSTYPE(linux)dnl

DOMAIN(generic)dnl

FEATURE(`smrsh',`/usr/sbin/smrsh')dnl

FEATURE(`local_lmtp',`/usr/sbin/mail.local')dnl

FEATURE(`local_procmail')dnl

MAILER(local)dnl

MAILER(smtp)dnl

MAILER(procmail)dnl

----------

## CobraNMU

I tried to unemerged sendmail. Problem was, it was attached to ssmtp. I didn't think that was installed, or how it worked when it was. So I removed them both and installed sendmail again. Then I could do everything except mailing localhost. So I looked online and found that I simply needed to change the permissions on one file.

chmod 2555 /usr/sbin/sendmail

Everything works like a charm now.

----------

## supermihi

Thanks, same problem for me, now solved  :Smile: 

----------

