# Sendmail - can not chdir(/var/spool/clientmqueue/)



## soulviasound (May 24, 2012)

Hi

I try to setup sendmail for using with php mail() function. When I try to send a test mail from shell I get this error. 


```
localhost# mail -v mailtest@test.com
Subject: test
test
.
EOT
can not chdir(/var/spool/clientmqueue/): Permission denied
Program mode requires special privileges, e.g., root or TrustedUser.
```

For security reasons I don't want to change permission for mail service. Here are the permissions.


```
localhost# ls -la /var/spool/clientmqueue
total 12
drwxr-x---  2 root  wheel  512 Jan 27 06:16 .
drwxr-xr-x  8 root  wheel  512 Jan 27 06:16 ..
-rw-------  1 root  wheel   49 Jan 27 06:16 sm-client.pid

localhost# uname -a
FreeBSD soulviasound.com 9.0-RELEASE FreeBSD 9.0-RELEASE #0: Tue Jan  3 07:15:25 UTC 2012     
root@obrian.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC  i386
```

Any idea how can I solve this?


----------



## inky (May 24, 2012)

Hello, please show permissions for /usr/libexec/sendmail/sendmail.

On 8.2 version of FreeBSD it*'*s 
	
	



```
-r-xr-sr-x  1 root  smmsp  686216 Apr  8 22:29
```
/usr/libexec/sendmail/sendmail

*I*f it's www:www - try to set it as root:smmsp. Hope it help you.


----------



## soulviasound (May 25, 2012)

Thank you for the reply. The permission for /usr/libexec/sendmail/sendmail was:


```
drwxr-xr-x  2 root  wheel     512 Jan 27 06:20 .
drwxr-xr-x  6 root  wheel    1536 Jan 27 06:20 ..
-r-xr-xr-x  1 root   wheel  699144 Jan 27 06:20 sendmail
```

Then I *chown*'ed it to: 


```
drwxr-xr-x  2 root  smmsp     512 Jan 27 06:20 .
drwxr-xr-x  6 root  wheel    1536 Jan 27 06:20 ..
-r-xr-xr-x  1 root  smmsp  699144 Jan 27 06:20 sendmail
```

I tried again a test mail, but same error.


----------



## soulviasound (May 25, 2012)

I solved it like this:


```
chown -R root:smmsp /var/spool

chmod 770 /var/spool

chmod 770 /var/spool/clientmqueue
```


----------

