postfix sasl "cannot connect to saslauthd server: No such file or directory"

27,382

Are you perhaps missing the symlink from /var/run/saslauthd to /var/spool/postfix/var/run/saslauthd?

From my working system:

root@mail:/etc/postfix/sasl# ls -la /var/run/saslauthd
lrwxrwxrwx 1 root root 36 Dec 31  2010 /var/run/saslauthd -> /var/spool/postfix/var/run/saslauthd
Share:
27,382

Related videos on Youtube

Admin
Author by

Admin

Updated on September 18, 2022

Comments

  • Admin
    Admin almost 2 years

    I try to setup postfix with smtp authentication. I want to use /etc/shadow as my realm

    Unfortunately I get a "generic error" when i try to authenticate

    # nc localhost 25
    220 mail.foo ESMTP Postfix
    AUTH PLAIN _base_64_encoded_user_name_and_password_
    535 5.7.8 Error: authentication failed: generic failure
    

    In the mail.warn logfile i get the following entry

    Oct  8 10:43:40 mail postfix/smtpd[1060]: warning: SASL authentication failure: cannot connect to saslauthd server: No such file or directory
    Oct  8 10:43:40 mail postfix/smtpd[1060]: warning: SASL authentication failure: Password verification failed
    Oct  8 10:43:40 mail postfix/smtpd[1060]: warning: _ip_: SASL PLAIN authentication failed: generic failure
    

    However the sasl setup seems to be fine

    $ testsaslauthd -u _user_ -p _pass_
    0: OK "Success."
    

    i added smtpd_sasl_auth_enable = yes to the main.cf

    This is my smtpd.conf

    $ cat /etc/postfix/sasl/smtpd.conf 
    pwcheck_method: saslauthd
    mech_list: PLAIN LOGIN
    saslauthd_path: /var/run/saslauthd/mux
    autotransition:true
    

    I tried this conf with the last two commands and without.

    I'm running debian stable.

    How can postfix find and connect to the saslauthd server?

    Edit:

    I'm not sure whether postfix runs in a chroot The master.cf looks like this: http://pastebin.com/Fz38TcUP

    saslauth is located in the sbin

    $ which saslauthd
    /usr/sbin/saslauthd
    

    The EHLO has this response

    EHLO _server_name_
    250-_server_name_
    250-PIPELINING
    250-SIZE 10240000
    250-VRFY
    250-ETRN
    250-STARTTLS
    250-AUTH LOGIN PLAIN
    250-ENHANCEDSTATUSCODES
    250-8BITMIME
    250 DSN
    
    • Admin
      Admin over 12 years
      Are you running Postfix in chroot?
    • Admin
      Admin over 12 years
      So where is your saslauthd located? What does the EHLO show?
    • Admin
      Admin over 12 years
      # which saslauthd /usr/sbin/saslauthd my master.cf looks like this: pastebin.com/Fz38TcUP
    • Admin
      Admin about 12 years
      is /var/run/saslauthd/mux made available in the chroot somehow? If not, there might be your problem.
    • Admin
      Admin over 8 years
      I had the same problem, but when I ran postfix outside of the chroot it worked fine, I also added saslauthd_path: /var/run/saslauthd/mux in my /etc/postfix/sasl/smtpd.conf file.
  • Gaia
    Gaia about 7 years
    is it normal for an update followed by a restart to remove the symlink? this happens from time to time on ubuntu 16.04
  • Paul Gear
    Paul Gear almost 7 years
    /var/run is a symlink to /run nowadays, which is a temporary file system that does not survive reboots; recent packages should recreate this automatically - maybe you have an edited startup script?
  • Paul Gear
    Paul Gear almost 7 years
    I'm out of ideas, sorry. :-(
  • Brent Baccala
    Brent Baccala over 5 years
    I had to move this directory and create this symlink manually on Ubuntu 18.04.1 LTS (bionic) after installing the distribution's standard postfix and sasl2-bin packages.
  • Michel
    Michel over 5 years
    This seems necessary on Ubuntu 16 (and up) servers. Maybe also related to upgrading and not clean install issues. I modified the saslauthd startup script to recreate the link: ln -sfn /var/spool/postfix/var/run/saslauthd /var/run/saslauthd
  • David Tinker
    David Tinker about 5 years
    This blog from 2005 sorted out my similar issue: jimmy.co.at/weblog/2005/12/05/postfix-and-sasl-debian
  • MiSHuTka
    MiSHuTka over 2 years
    Could you please explain or provide some url about why this symlink is necessary?
  • Paul Gear
    Paul Gear over 2 years
    @MiSHuTka Postfix runs in a chroot jail in /var/spool/postfix, but saslauthd doesn't. So the saslauthd running outside the jail needs to point at the path where postfix expects the saslauthd files to be.
  • Paul Gear
    Paul Gear over 2 years
    @MiSHuTka Note also that nowadays saslauthd is automatically configured to point at the correct place, without the need for a symlink. See OPTIONS="-c -m /var/spool/postfix/var/run/saslauthd" in /etc/default/saslauthd.