CyberPanel FTP not working on Ubuntu Server
On CyberPanel server, FTP was not working. I checked the server with “netstat -lntp” command. No service was listening on port 21. Started pure-ftpd with command
1 |
systemctl start pure-ftpd-mysql |
To start pure-ftpd on boot, run
1 |
systemctl enable pure-ftpd-mysql |
Now FTP service started listening on port 21, but login to the FTP server failed with an error “Login authentication failed”.
pure-ftpd on CyberPanel server uses MySQL authentication. We need to configure pure-ftpd to use the “users” table in “cyberpanel” database.
Edit file
1 |
vi /etc/pure-ftpd/db/mysql.conf |
In this file, you need to add MySQL login details
1 2 3 4 |
MYSQLUser MYSQLPassword MYSQLDatabase cyberpanel MYSQLCrypt md5 |
If you don’t have a MySQL user, create one with
1 2 |
GRANT ALL PRIVILEGES ON *.* TO 'ftpadmin'@'localhost' IDENTIFIED BY 'USER_PASSWORD_HERE' WITH GRANT OPTION; GRANT PROXY ON ''@'' TO 'ftpadmin'@'localhost' WITH GRANT OPTION; |
Here is the example config
1 2 3 4 5 6 7 8 9 |
MYSQLSocket /var/run/mysqld/mysqld.sock MYSQLUser ftpadmin MYSQLPassword MYSQL_USER_PW_HERE MYSQLDatabase cyberpanel MYSQLCrypt md5 MYSQLGetPW SELECT Password FROM users WHERE User='\L' MYSQLGetUID SELECT Uid FROM users WHERE User='\L' MYSQLGetGID SELECT Gid FROM users WHERE User='\L' MYSQLGetDir SELECT Dir FROM users WHERE User='\L' |
If you don’t have MySQL auth enabled, enable it with
1 |
ln -s /etc/pure-ftpd/conf/MySQLConfigFile /etc/pure-ftpd/auth/30mysql |
Restart pure-ftp-mysql with
1 |
systemctl restart pure-ftpd-mysql |
See CyberPanel