Es muss MySQL installiert sein. Also bitte als Voraussetzung erst MySQL fertig haben.
Genaue Anleitung MySQL
Wenn MySQL läuft, geht es direkt los
apt-get install pure-ftpd-mysql
adduser --system ftp
BaseUser für /home/ftp
cd /etc/pure-ftpd/conf
echo clf:/var/log/pure-ftpd/transfer.log > AltLog
echo yes > BrokenClientsCompatibility
echo yes > ChrootEveryone
echo yes > DisplayDotFiles
echo yes > DontResolve
echo 185.163.118.100 > ForcePassiveIP
echo UTF-8 > FSCharset
echo 1000 > MinUID
echo /etc/pure-ftpd/db/mysql.conf > MySQLConfigFile
echo yes > NoAnonymous
echo yes > PAMAuthentication
echo 40110 40210 > PassivePortRange
echo /etc/pure-ftpd/pureftpd.pdb > PureDB
echo 1 > TLS
echo HIGH > TLSCipherSuite
echo no > UnixAuthentication
TLS zickt manchmal. Abhilfe:
echo 0 > TLS
service pure-ftpd-mysql restart
Was auch helfen kann, ist den FORCE auf PASV zu unterbinden.
Dazu den Inhalt von /etc/pure-ftpd/conf/ForcePassivIP löschen.
/etc/pure-ftpd/db/mysql.conf
#MYSQLServer localhost
#MYSQLPort 3306
MYSQLSocket /var/run/mysqld/mysqld.sock
MYSQLUser pureftpd-user
MYSQLPassword Pass
MYSQLDatabase pureftpd
MYSQLCrypt cleartext
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"
#MySQLGetQTAFS SELECT QuotaFiles FROM users WHERE User="\L"
#MySQLGetQTASZ SELECT QuotaSize FROM users WHERE User="\L"
#MySQLGetBandwidthUL SELECT ULBandwidth FROM users WHERE User="\L"
#MySQLGetBandwidthDL SELECT DLBandwidth FROM users WHERE User="\L"
mysql -u root -p
CREATE DATABASE pureftpd;
INSERT INTO `mysql`.`tables_priv` (`Host`, `Db`, `User`, `Table_name`, `Grantor`, `Table_priv`) VALUES ('localhost', 'pureftpd', 'pureftpd-user', 'pureftpd.*', 'me', 'Select,Insert,Update,Delete,Create,Drop');
INSERT INTO `user` (`Host`, `User`, `Select_priv`, `Insert_priv`, `Update_priv`, `Delete_priv`, `Create_priv`, `Drop_priv`, `Reload_priv`, `Shutdown_priv`, `Process_priv`, `File_priv`, `Grant_priv`, `References_priv`, `Index_priv`, `Alter_priv`, `Show_db_priv`, `Super_priv`, `Create_tmp_table_priv`, `Lock_tables_priv`, `Execute_priv`, `Repl_slave_priv`, `Repl_client_priv`, `Create_view_priv`, `Show_view_priv`, `Create_routine_priv`, `Alter_routine_priv`, `Create_user_priv`, `Event_priv`, `Trigger_priv`, `Create_tablespace_priv`, `ssl_type`, `ssl_cipher`, `x509_issuer`, `x509_subject`, `max_questions`, `max_updates`, `max_connections`, `max_user_connections`, `plugin`, `authentication_string`, `password_expired`, `password_last_changed`, `password_lifetime`, `account_locked`, `Create_role_priv`, `Drop_role_priv`, `Password_reuse_history`, `Password_reuse_time`, `Password_require_current`, `User_attributes`) VALUES ('localhost', 'pureftpd-user', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', '', '', '', '', 0, 0, 0, 0, 'mysql_native_password', '*PASS', 'N', NULL, NULL, 'N', 'N', 'N', NULL, NULL, NULL, NULL);
FLUSH PRIVILEGES;
quit;
USE pureftpd;
CREATE TABLE users (
User varchar(16) NOT NULL default '',
Password varchar(64) NOT NULL default '',
Uid int(11) NOT NULL default '-1',
Gid int(11) NOT NULL default '-1',
Dir varchar(128) NOT NULL default '',
QuotaFiles int(11) NOT NULL default '10000',
QuotaSize int(11) NOT NULL default '1000',
ULBandwidth int(11) NOT NULL default '500',
DLBandwidth int(11) NOT NULL default '500',
PRIMARY KEY (User)
)
FLUSH PRIVILEGES;
quit;
chmod 600 /etc/pure-ftpd/db/mysql.conf
chown root:root /etc/pure-ftpd/db/mysql.conf
SSL ist nicht nötig.
mkdir -p /etc/ssl/private/
openssl req -x509 -nodes -newkey rsa:1024 -keyout \
/etc/ssl/private/pure-ftpd.pem \
-out /etc/ssl/private/pure-ftpd.pem
chmod 600 /etc/ssl/private/*.pem
Nutzer hinzufügen MySQL
mysql -u pureftpd-user -p
use pureftpd;
INSERT INTO `users` (`User`, `Password`, `Uid`, `Gid`, `Dir`, `QuotaFiles`, `QuotaSize`, `ULBandwidth`, `DLBandwidth`) VALUES ('secbak', 'TestseinPW', -1, -1, '/home/ftp/_BACKUP_MAIN', -1, -1, -1, -1);
ftpuser anlegen
# addgroup ftpgroup
# useradd -g ftpgroup -d /dev/null -s /etc ftpuser
# mkdir /home/ftp
# history | grep user
# usermod -d /home/ftp ftpuser
# cd /home/ftp
# chown ftpuser:ftpgroup ftp
Config per RAR übertragen! Liegt im _SHARED_
WICHTIG: Nun schnappen wir uns die Group- und UserID und setzen diesen als Default in der /etc/pure-ftpd/db/mysql.conf
cat /etc/passwd
und
cat /etc/group
UID und Gruppe sind dort zu finden
In der Conf als MYSQLDefaultUID + GID setzen!
# systemctl restart pure-ftpd
User zukünftig in MySQL durch:
user pureftpd;
update users set password='passw' where User='bakuser';
update users set password='passw' where User='bakuser2';
flush privileges;