I have a ubuntu 20.04 server and a domain example.com
I installed postfix and opendkim via apt.
In /etc/opendkim.conf
I have
Socket local:/run/opendkim/opendkim.sock
The file exists.
$ ls -l /run/opendkim/opendkim.sock
ls: cannot access '/run/opendkim/opendkim.sock': Permission denied
$ sudo ls -l /run/opendkim/opendkim.sock
srwxrwx--- 1 opendkim opendkim 0 Oct 4 21:19 /run/opendkim/opendkim.sock
I added postfix to opendkim group.
$ groups postfix
postfix : postfix opendkim
I also tried reboot by sudo reboot
.
When I do this
echo "This is the body of the email." | mail -s "Subject of the Email" [email protected]
But I got this error.
Oct 04 23:58:24 ubuntu postfix/cleanup[52998]:
warning: connect to Milter service local:/run/opendkim/opendkim.sock: No such file or directory
I took a closer look
$ ps -p 52998 -o pid,comm,user,%cpu,%mem,stime,tty
PID COMMAND USER %CPU %MEM STIME TT
52998 cleanup postfix 0.0 0.2 00:00 ?
The user is postfix and it should have access to the socket file, but the system journal says no.
Postfix runs chrooted, so you need to put
opendkim
socket intopostfix
chroot.