apt update
apt install pure-ftpd
rm -rf /etc/pure-ftpd/conf/* \
&& echo "clf:/var/log/pure-ftpd/transfer.log" > /etc/pure-ftpd/conf/AltLog \
&& echo "UTF-8" > /etc/pure-ftpd/conf/FSCharset \
&& echo "1000" > /etc/pure-ftpd/conf/MinUID \
&& echo "yes" > /etc/pure-ftpd/conf/NoAnonymous \
&& echo "no" > /etc/pure-ftpd/conf/PAMAuthentication \
&& echo "no" > /etc/pure-ftpd/conf/UnixAuthentication \
&& echo "/etc/pure-ftpd/pureftpd.pdb" > /etc/pure-ftpd/conf/PureDB \
&& touch /etc/pure-ftpd/pureftpd.pdb \
&& echo "027 007" > /etc/pure-ftpd/conf/Umask \
&& echo "yes" > /etc/pure-ftpd/conf/ChrootEveryone \
&& echo "yes" > /etc/pure-ftpd/conf/Daemonize \
&& echo "yes" > /etc/pure-ftpd/conf/DontResolve \
&& echo "no" > /etc/pure-ftpd/conf/BrokenClientsCompatibility \
&& echo "50" > /etc/pure-ftpd/conf/MaxClientsNumber \
&& echo "no" > /etc/pure-ftpd/conf/VerboseLog \
&& echo "yes" > /etc/pure-ftpd/conf/DisplayDotFiles \
&& echo "no" > /etc/pure-ftpd/conf/AnonymousOnly \
&& echo "ftp" > /etc/pure-ftpd/conf/SyslogFacility \
&& echo "no" > /etc/pure-ftpd/conf/AnonymousCanCreateDirs \
&& echo "30000 35000" > /etc/pure-ftpd/conf/PassivePortRange \
&& echo "no" > /etc/pure-ftpd/conf/AllowUserFXP \
&& echo "no" > /etc/pure-ftpd/conf/AllowAnonymousFXP \
&& echo "no" > /etc/pure-ftpd/conf/ProhibitDotFilesWrite \
&& echo "no" > /etc/pure-ftpd/conf/ProhibitDotFilesRead \
&& echo "no" > /etc/pure-ftpd/conf/AutoRename \
&& echo "yes" > /etc/pure-ftpd/conf/AnonymousCantUpload \
&& ln -sf /etc/pure-ftpd/conf/PureDB /etc/pure-ftpd/auth/50pure \
&& ln -sf /etc/pure-ftpd/conf/PureDB /etc/pure-ftpd/auth/40PureDB \
&& systemctl stop pure-ftpd \
&& systemctl start pure-ftpd \
&& systemctl status pure-ftpd
# To enable both plain-text and TLS encryption
echo "1" > /etc/pure-ftpd/conf/TLS
# Or disable plain-text and use TLS encryption only
echo "2" > /etc/pure-ftpd/conf/TLS
apt install -y certbot
certbot certonly --standalone --agree-tos --cert-name ftp.yourdomain.tld -n -m [email protected] -d ftp.yourdomain.tld -d ftp2.yourdomain.tld --pre-hook "service apache2 stop" --post-hook "service apache2 start"
echo $(certbot certonly --standalone --agree-tos --cert-name ftp.yourdomain.tld -n -m [email protected] -d ftp.yourdomain.tld -d ftp2.yourdomain.tld --pre-hook "service apache2 stop" --post-hook "service apache2 start") \
cd /etc/letsencrypt/live/ftp.yourdomain.tld/ \
&& cat cert.pem privkey.pem > pure-ftpd.pem \
&& rm /etc/ssl/private/pure-ftpd.pem \
&& mv pure-ftpd.pem /etc/ssl/private/ \
&& chmod 600 /etc/ssl/private/pure-ftpd.pem \
&& service pure-ftpd restart
#Add new user
groupadd ftpgroup
useradd -g ftpgroup -d /dev/null -s /etc ftpuser -d /home/ftpuser
chown -R ftpuser:ftpgroup /home/ftpuser
pure-pw useradd ftpaccountname -u ftpuser -g ftpgroup -d /home/ftpuser
pure-pw mkdb
pure-pw show ftpaccountname
#Reset FTP User Password
pure-pw list
pure-pw passwd ftpaccountname
pure-pw mkdb
#Delete FTP User
pure-pw userdel ftpaccountname
pure-pw mkdb