Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

So yesterday Webmin deleted my /etc/passwd and although it looks like everything is working, I can't get sendmail to work when used in a PHP script.

Using mail() returns false, using PHPMailer results in "Mailer cannot execute sendmail".

I am 100% sure that this problem has happened because of the passwd file, I just can't figure out how to fix it.

I noticed a few users got corrupt and I had to replace them.

I should probably mention, if I try and send it through sendmail itself it works perfectly.

For people saying restore the /etc/passwd, I have already done this and the issue still remains.

grep smmsp /etc/group

ls -ld /var/spool/mqueue/
drwx------ 2 root mail 4096 Nov  8 02:56 /var/spool/mqueue/

ls -ld /var/spool/clientmqueue/
drwxrwx--- 2 smmsp smmsp 4096 Nov  8 02:55 /var/spool/clientmqueue/

ls -ld /var/spool/mail/
drwxrwxr-x 2 root mail 4096 Nov  8 02:18 /var/spool/mail/

ls -l /usr/sbin/sendmail
lrwxrwxrwx 1 root root 21 Aug  8 21:29 /usr/sbin/sendmail -> /etc/alternatives/mta

ls -l /usr/sbin/sendmail.sendmail
-rwxrwsrwx 1 root smmsp 806460 Aug 11 17:32 /usr/sbin/sendmail.sendmail


Nov  8 15:58:18 jbrunton sendmail[6222]: pA8FwIPJ006222: SYSERR(UID0): Who are you?:       Permission denied
Nov  8 15:58:18 jbrunton sendmail[6222]: pA8FwIPJ006222:, size=456, class=0, nrcpts=1, msgid=<>, relay=root@localhost
Nov  8 15:58:18 jbrunton sendmail[6225]: pA8FwIdW006225: SYSERR(root): collect: Cannot write ./dfpA8FwIdW006225 (bfcommit, uid=0, gid=51): Permission denied
Nov  8 15:58:18 jbrunton sendmail[6225]: pA8FwIdW006225: from=<>, size=598, class=0, nrcpts=1, proto=ESMTP, daemon=MTA, relay=localhost.localdomain []
Nov  8 15:58:18 jbrunton sendmail[6222]: pA8FwIPJ006222:, delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30456, relay=[] [], dsn=4.0.0, stat=Deferred: 421 4.3.0 collect: Cannot write ./dfpA8FwIdW006225 (bfcommit, uid=0, gid=51): Permission denied
share|improve this question
Did you take a look at /var/log/maillog? – quanta Nov 8 '11 at 9:20
Just checked it now and I am getting this error: Nov 8 03:18:54 jbrunton sendmail[25949]: NOQUEUE: SYSERR(UID48): /etc/mail/ line 432: readcf: option RunAsUser: unknown user smmsp: Permission denied – JamieB Nov 8 '11 at 9:22
How did you restore /etc/passwd? grep smmsp /etc/passwd? – quanta Nov 8 '11 at 9:28
Just renamed an old file and dumped it in the /etc/ folder, I assume this wasn't the way to restore the passwd file? Grep returns smmsp:x:51:51::/var/spool/mqueue:/sbin/nologin – JamieB Nov 8 '11 at 9:29
Edit your original post and post all the output of grep smmsp /etc/group, ls -ld /var/spool/mqueue/, ls -ld /var/spool/clientmqueue/, ls -ld /var/spool/mail/, ls -l /usr/sbin/sendmail. – quanta Nov 8 '11 at 9:37

To help avoid this problem in future, you can version control /etc, so in case of errors there you can always just revert to a previous version. The etckeeper package can help with this, by keeping track of permissions within the version control repository, and integrating commits into maintenance operations.

share|improve this answer
Thanks but I am looking for a solution to the problem not hindsight. – JamieB Nov 8 '11 at 9:43
This is not hindsight: it's foresight. I know it doesn't help you right now, but it can in the future. – Andrew Schulman Nov 8 '11 at 9:44

The passwd file can be regenerated but with a lot of effort. Instead, you can use the following sample passwd file to at least make some of your system accounts work/

list:x:38:38:Mailing List Manager:/var/list:/bin/sh

As I have added the user smmmp to the passwd file, so your sendmail might work fine.

Also, look for /etc/passwd- file as well, as it is backup passwed kept by OS as well. it might be there.

share|improve this answer
Thanks but I already kept an old backup of my passwd file, sendmail just seems to think smmsp doesn't exist. – JamieB Nov 8 '11 at 9:48
How often is this passwd- file backuped? Who perform this backup? passwd command? OS kernel? On what frequency? – jyz Feb 15 '13 at 18:15

Add the apache user to the smmsp group and try again:

# usermod -a -G smmsp apache
share|improve this answer
Thanks, still nothing though :( – JamieB Nov 8 '11 at 15:20

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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