FTP not working - 530 Login authentication failed

Seems you did not completely remove all traces of ftp on your server

sudo killall -u ftpuser
sudo userdel -f ftpuser
sudo groupdel ftpgroup

Then run the script. Am still running my vsftpd with no errors.

I should probably add a way of completely deleting pure-ftpd on the script makes it easier.

EDIT: improved the script to wipe out the user, group, all traces of pure-ftpd and install vsftpd

The script stopped running and it gave me error message. " cannot remove ‘/etc/pure-ftpd’: No such file or directory failed"

ubuntu@instance-test:~$ sudo killall -u ftpuser
ubuntu@instance-test:~$ sudo userdel -f ftpuser
ubuntu@instance-test:~$ sudo groupdel ftpgroup
ubuntu@instance-test:~$ sh <(curl https://raw.githubusercontent.com/josephgodwinkimani/cyberpanel-mods/main/install_vsftpd.sh || wget -O - https://raw.githubusercontent.com/josephgodwinkimani/cyberpanel-mods/main/install_vsftpd.sh)
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1292 100 1292 0 0 5598 0 --:–:-- --:–:-- --:–:-- 5617

Remove pure-ftpd …

Reading package lists… Done
Building dependency tree… Done
Reading state information… Done
Package ‘pure-ftpd’ is not installed, so not removed
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Reading package lists… Done
Building dependency tree… Done
Reading state information… Done
Package ‘pure-ftpd’ is not installed, so not removed
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
rm: cannot remove ‘/etc/pure-ftpd’: No such file or directory
failed

Yes rerun it on another server and got that error cause its supposed to stop if anything fails. Just added conditions however you can just run the commands here as i try to improve it for everyone

sudo apt-get autoremove pure-ftpd -y
sudo apt-get purge pure-ftpd -y
sudo rm -r /etc/pure-ftpd
sudo killall -u ftpuser
sudo userdel -f ftpuser
sudo groupdel ftpgroup
sudo apt install vsftpd
sudo adduser ftpuser
echo "DenyUsers ftpuser" >> /etc/ssh/sshd_config
sudo service sshd restart
sudo addgroup ftpgroup
sudo usermod -d /home ftpuser
sudo usermod -g ftpgroup ftpuser
sudo chown ftpuser:ftpuser /home
sudo mv /etc/vsftpd.conf /etc/vsftpd.conf.bak
sudo nano /etc/vsftpd.conf

add the following:

listen=NO
listen_ipv6=YES
anonymous_enable=NO
local_enable=YES
write_enable=YES
local_umask=022
dirmessage_enable=YES
use_localtime=YES
xferlog_enable=YES
connect_from_port_20=YES
chroot_local_user=YES
secure_chroot_dir=/var/run/vsftpd/empty
pam_service_name=vsftpd
force_dot_files=YES
pasv_min_port=40000
pasv_max_port=50000
allow_writeable_chroot=YES

FInally run

sudo systemctl restart vsftpd
sudo systemctl status vsftpd

Access ftp using username ftpuser and password you chose here sudo adduser ftpuser

Everything went well except the “echo “DenyUsers ftpuser” >> /etc/ssh/sshd_config” gave me a permission denied error.

ubuntu@instance-test:~$ sudo systemctl status vsftpd
● vsftpd.service - vsftpd FTP server
Loaded: loaded (/lib/systemd/system/vsftpd.service; enabled; vendor preset>
Active: active (running) since Tue 2022-12-13 12:40:53 UTC; 12min ago
Process: 825 ExecStartPre=/bin/mkdir -p /var/run/vsftpd/empty (code=exited,>
Main PID: 826 (vsftpd)
Tasks: 1 (limit: 1076)
Memory: 1016.0K
CPU: 9ms
CGroup: /system.slice/vsftpd.service
└─826 /usr/sbin/vsftpd /etc/vsftpd.conf

Dec 13 12:40:53 instance-test systemd[1]: Starting vsftpd FTP server…
Dec 13 12:40:53 instance-test systemd[1]: Started vsftpd FTP server.
lines 1-13/13 (END)

When I try to connect through filezila, I am getting the following error message.
ftpError02

I know port 22 and 990 are open.

ftpuser can only upload files in /home/ftpuser to have users only add files at /home/somedomain.com/public_html

Add new user say you have a client at www.domain.com

sudo adduser newcustomer
sudo usermod -d /home/mydomain.com newcustomer
sudo usermod -g ftpgroup newcustomer
sudo apt install acl
setfacl -R -m u:newcustomer:rwx /home/mydomain.com
## sudo chown -R newcustomer:newcustomer /home/mydomain.com

EDIT: Allow users to see subdomains if they choose not to point them to a subdirectory inside public_html

EDIT: changing permissions should allow the owner (root/user that created website) to have same access.

Screenshot from 2022-12-13 16.01.07

Use these settings for SSL ENCRYPTED connections

Screenshot from 2022-12-13 17.34.44

Improved the script and tested it. Works as expected. Should allow you to manage /home/ftpuser you are free to add users as described here:FTP not working - 530 Login authentication failed - #25 by josephgodwinke

In ssh terminal run:

sh <(curl https://raw.githubusercontent.com/josephgodwinkimani/cyberpanel-mods/main/install_vsftpd.sh || wget -O - https://raw.githubusercontent.com/josephgodwinkimani/cyberpanel-mods/main/install_vsftpd.sh)

Incase of any issues with ssl/tls and you would rather live without it do the following:

sudo nano /etc/vsftpd/vsftpd.conf
# remove the following
ssl_enable=YES
allow_anon_ssl=NO
force_local_data_ssl=YES
force_local_logins_ssl=YES
ssl_tlsv1_1=YES
ssl_tlsv1_2=YES
ssl_tlsv1=NO
ssl_sslv2=NO
ssl_sslv3=NO
require_ssl_reuse=YES
ssl_ciphers=HIGH
rsa_cert_file=/etc/ssl/certs/vsftpd.crt
rsa_private_key_file=/etc/ssl/private/vsftpd.key

Restart vsftpd service

after these steps, i cheked pure-ftpd status and looks like works correctly, but when i try to login from filezilla:

  1. when generated new one pure-ftpd.pem file:
    openssl req -newkey rsa:1024 -new -nodes -x509 -days 3650 -subj “/C=US/ST=Denial/L=Springfield/O=Dis/CN=example.com” -keyout /etc/ssl/private/pure-ftpd.pem -out /etc/ssl/private/pure-ftpd.pem

error:
00:21:08 Status: Resolving address of example.com
00:21:08 Status: Connecting to xx.xx.xxx.xxx:21…
00:21:08 Status: Connection attempt failed with “ECONNREFUSED - Connection refused by server”.
00:21:08 Error: Could not connect to server

  1. when i used original pure-ftpd.pem file after Cyber Panel installation:

error:
Host: example.com:21 hostname does not match certificate

what can i do?

Did you ever figure this out? I am having the exact same issue. Running Cyperpanel 2.3 on a Vultr instance with Ubuntu 20.04 LTS x64 and the FTP account I create does not work. How can I test if my issue i also caused by pure-ftpd?

PS: I ran some commands I found in this and another thread and this is the output I got:

Better and more secure option is setup SFTP that seems to be more reliable.