How to setup FTP server on Linux and add new FTP user?

useradd -m -d /home/peter -p PASSWORD_HERE peter

that command will create /home/peter, a group called peter, a user named peter, and a password of PASSWORD_HERE.
By default this account should only be able to access it's home folder.

Install FTP server:

yum install vsftpd 2>/dev/null|| sudo apt install vsftpd 2>/dev/null
service vsftpd start 2>/dev/null||sudo systemctl start vsftpd.service2>/dev/null
service vsftpd status 2>/dev/null||sudo systemctl status vsftpd.service 2>/dev/null
chkconfig vsftpd on 2>/dev/null||sudo systemctl enable vsftpd.service 2>/dev/null

cat /etc/vsftpd/*user*

If need root user access, then remove root from /etc/vsftpd/*user* files and possibly restart the service.

To enable ftp write access to protected directory of the user (/home/peter) i had to run "setsebool ftpd_full_access on", but if using subdirectories like /home/peter/ftp, that may not be needed. FTP directory should be created(owned) by the ftp user we created earlier. And have write access (maybe "chmod 775 /home/peter/ftp").

TLS/SSL (optional):

sudo mkdir /etc/ssl/private;openssl req -x509 -nodes -days 36500 -newkey rsa:1024 -keyout /etc/ssl/private/vsftpd.pem -out /etc/ssl/private/vsftpd.pem
hit Enter keys until see "Common Name (eg, your name or your server's hostname)" where you type server public IP or the domain

sudo echo -e "rsa_cert_file=/etc/ssl/private/vsftpd.pem\nrsa_private_key_file=/etc/ssl/private/vsftpd.pem\nssl_enable=YES\nallow_anon_ssl=NO\nfor ce_local_data_ssl=YES\nforce_local_logins_ssl=YES\ nssl_tlsv1=YES\nssl_sslv2=NO\nssl_sslv3=NO\nrequir e_ssl_reuse=NO\nssl_ciphers=HIGH" >> /etc/vsftpd/vsftpd.conf;service vsftpd restart 2>/dev/null||sudo systemctl restart vsftpd.service2>/dev/null

Sidenote: when i tried to comment-out "chroot_local_user=YES" to prevent users going outside their directories, it prevent login with certificate error. Anyone know how to solve it?

FTP BRUTE FORCE PROTECTION: https://internetlifeforum.com/security-protection/15520-tutorial-enabling-vsftpd-bruteforce-protection-fail2ban-centos-7-a/