How to fix “530 Login authentication failed” for ISPConfig FTP logins?

Symptoms

You have installed the ISPConfig server admi panel (in my case, version 3.0.5.3), all according to their guidelines called "The Perfect Server". In this case, I used the setup instructions for ISPConfig 3 on Debian 7.0 Wheezy with Apache2, BIND, Dovecot. Then you create a website in ISPConfig, create an FTP account for it in ISPConfig, try to log in with this account, and it does not work. The client-side FTP log would be simply:

Command:    USER c1testuser
Response:    331 User c1testuser OK. Password required
Command:    PASS ***************
Response:    530 Login authentication failed
Error:    Critical error
Error:    Could not connect to server

Concurrently, you would see something like this in /var/log/syslog:

Nov 19 16:48:53 one pure-ftpd: (?@xxx.xxx.xxx.xxx) [INFO] New connection from xxx.xxx.xxx.xxx
Nov 19 16:48:53 one pure-ftpd: (?@xxx.xxx.xxx.xxx) [INFO] PAM_RHOST enabled. Getting the peer address
Nov 19 16:49:00 one pure-ftpd: (?@xxx.xxx.xxx.xxx) [WARNING] Authentication failed for user [c1testuser]
Nov 19 16:49:00 one pure-ftpd: (?@xxx.xxx.xxx.xxx) [INFO] Logout.

And something like this in /var/log/auth.log:

Nov 19 16:48:53 one pure-ftpd: pam_unix(pure-ftpd:auth): authentication failure; logname= uid=0 euid=0 tty=pure-ftpd ruser=c1testuser rhost=

Solution

This problem can have several reasons, so you should try the following alternatives. I have roughly ordered them into a logical order of things to check, starting from frequent causes.

  1. Did you include the ISPConfig username prefix? In ISPConfig, when you create a FTP user, SSH user etc., the panel will prepend this username with a prefix that you can configure in "System -> Interface -> Main Config -> Sites". If the prefix uses "c[CLIENTID]" in that form, it might be "c1" for example. So when setting up your FTP client, do not just use the username you entered, but put that prefix before. Just as you see the username listed in "Sites -> FTP Accounts" in column "username".
  2. You do not have to include the domain name into the user name. At some webhosters, the actual username would be something like "user1@example.com". This is not required for ISPConfig FTP logins [source], and probably would not work either.
  3. Check that the job queue is empty. In ISPConfig, your tasks (like creating an FTP user) get processed deferredly by a cron job that runs every minute. But if it fails, the job queue can get stuck. Check in ISPConfig in "Monitor -> System State -> Show Jobqueue" to make sure it's empty, or if not, fix this as shown here.
  4. If you have "Replication failed" errors in the job queue, sync ISPConfig versions across servers. This is only relevant if you use ISPConfig for multiple combined servers. See the instructions.
  5. Make sure you can at least connect with system users via FTP. All users that you create in ISPConfig via "Sites -> Web Access -> FTP Accounts" are virtual users, which are mapped to system users when logging in via FTP. The mapping is defined in the "Options" tab, " field when creating a FTP account in ISPConfig, and managed in MySQL database dbispconfig, table ftp_user. The system users to which they are mapped (like web1, web2 etc.) cannot be used for FTP logins either as they have no passwords defined (see /etc/shadow: ! in the second field means "no password authentication"). However, when you create SSH users in ISPConfig, this results in system users with passwords. So try to log in with an existing SSH user, and do not forget the prefix added by ISPConfig to your chosen username. (Just check "Sites -> Shell-User" to see the proper user names.) If this works, only virtual users' authentication is broken, else something more profound could be wrong (Firewall config, fail2ban config etc.). Note that in a working setup, you should be able to login with both system and virtual users into FTP (I tested it). I was able to successfully log in using these settings (in FileZilla):
    • host: server's IPv4 address; also works with the domain name of any website hosted on this server
    • port: empty (means the default value 21 is used)
    • protocol: FTP
    • encryption: Use Plain FTP
    • logon type: Normal
    • user: the username incl. the prefix added by ISPConfig
    • password: the password
    • all other fields: left at their defaults
  6. Check if pure-ftpd-mysql's queries arrive at the database with the virtual users. You can do so by enabling MySQL query logging:
    1. In /etc/mysql/my.cnf, enable or insert the following lines:
      general_log_file        = /var/log/mysql/mysql.log
      general_log             = 1
    2. Restart the MySQL server: service mysql restart
    3. Try another failing FTP login, then look at /var/log/mysql/mysql.log to see what queries arrived at MySQL. Simply search for ftp_user, as all configured queries in /etc/pure-ftpd/db/mysql.conf include that table name. In my case, no queries arrived here at all. This can mean that you have the wrong variant of pureftp installed, see the next step.
    4. Do not forget to disable query logging again (and MySQL again) after you fixed this issue, as it's a performance killer.
  7. Make sure you have pure-ftpd-mysql installed. Execute apt-get install pure-ftpd-mysql and see if it wants to install the package; if yes, that's the issue here. Let it install the package, and afterwards your FTP logins with virtual users should work now. Because only the pure-ftpd-mysql variant includes MySQL based authentication. Note that /etc/init.d/pure-ftpd-mysql exists and that /etc/init.d/pure-ftpd-mysql restart resp. service pure-ftpd-mysql restart can be executed without an error message even before the pure-ftpd-mysql package is installed. These commands simply will not output anything instead of the server startup command, and that's the only symptom that something is wrong here.

I still have no idea how I missed to install pure-ftpd-mysql. I simply followed the "The Perfect Server" ISPConfig installation instructions and in my variant, on page 4, the correct package gets installed (where they run apt-get install pure-ftpd-common pure-ftpd-mysql quota quotatool).


Posted

in

,

by

Tags:

Comments

15 responses to “How to fix “530 Login authentication failed” for ISPConfig FTP logins?”

  1. RaalFy

    Thank you very much for this. I run Ubuntu 12.04 LTS, I also followed their “perfect server” guide. My problem was that pure-ftpd-common wasn’t installed. All resolved now. Thanks again 🙂

  2. odicha

    chattr not installed on minimal installation (vps).So ispconfig fails creating accounts

    root@tests:~# /usr/local/ispconfig/server/server.sh
    sh: chattr: command not found
    sh: chattr: command not found
    sh: chattr: command not found
    sh: chattr: command not found
    finished.

    Solved installing e2fsprogs

    apt-get install e2fsprogs

  3. I had the problem, that the system users could log in via FTP, but the virtual users not. After reading thousands of lines, i had the following idea:
    In my /etc/pure-ftpd/db/mysql.conf “MYSQLCrypt” was set to “cleartext”. I changed the value to “any” and now it works!

    I hope this will help someone!

  4. Aaron Bird

    I am having problems with this.

    I have tried all of the above. When I check the mysql logs after attempting to connect with a virtual user, the only query I see for ftp_users is a count(*).

    Connecting with a shell user works fine.

    When I do show databases, I don’t see a database for ftpd. Is that right? It is 100% installed.

  5. help! I checked all steps until step 6. The shell-User field was empty.. i tried installing pure-ftdp-mysql , it started installing then i see one line saying removing vsftpd. the installation was sucessfull! but it became worse, i couldn’t even connect now! i reinstalled vsftpd
    and now was able to connect but still suffering form the same problem! i don’t know what’s going on here

  6. Anonymous

    Thank you, I had somehow installed proftpd and removed pure-ftpd-mysql this helped me a bunch. If you are not getting output try “service pure-ftpd-mysql status” to ensure it is running.

  7. Daniel

    Thank you, after my FTP stopped working this helped me troubleshoot and fix the problem. For me the following did the trick: /etc/init.d/pure-ftpd-mysql restart
    I had no indication that the service actually didn’t run.

  8. Thanks for sharing your exp. Installing pure-ftpd-mysql did the trick. This were not my first setup of debian and ispconfig, but today this happened to me, too. The mysql-adapt for pure-ftpd were still not there. Another reason to stay at the good old /etc/init.d/…

  9. I have had this behavior frequently. I find that after I add a user in the ISP config interface I need to restart both the pure-ftpd-mysql service and the mysql service

  10. […] 12. How to fix “530 Login authentication failed” for ISPConfig FTP … […]

  11. […] 12. How to fix “530 Login authentication failed” for ISPConfig FTP … […]

  12. […] How to fix “530 Login authentication failed” for ISPConfig … […]

  13. […] 12. How to fix “530 Login authentication failed” for ISPConfig FTP … […]

  14. […] 12. How to fix “530 Login authentication failed” for ISPConfig FTP … […]

  15. […] 12. How to fix “530 Login authentication failed” for ISPConfig FTP … […]

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.