apt-get install libpam-mysql
anonymous_enable=NO local_enable=YES guest_enable=YES use_localtime=YES local_root=/home/vsftpd/$USER secure_chroot_dir=/var/run/vsftpd chroot_local_user=YES xferlog_enable=YES pam_service_name=vsftpd hide_ids=YES user_sub_token=$USER dirmessage_enable=YES local_umask=022 connect_from_port_20=YES write_enable=YES virtual_use_local_privs=YES
auth required pam_mysql.so user=vsftpd passwd=p455w0rd host=localhost db=vsftpd table=accounts usercolumn=username passwdcolumn=pass crypt=2 account required pam_mysql.so user=vsftpd passwd=p455w0rd host=localhost db=vsftpd table=accounts usercolumn=username passwdcolumn=pass crypt=2
create database vsftpd; use vsftpd; CREATE TABLE `accounts` ( -> `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY , -> `username` VARCHAR( 30 ) NOT NULL , -> `pass` VARCHAR( 50 ) NOT NULL , -> UNIQUE ( -> `username` -> ) -> ) ENGINE = MYISAM ; GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP ON vsftpd.* TO 'vsftpd'@'localhost' IDENTIFIED BY 'X0Bih4vtIbzgLPd9AxLM'; FLUSH PRIVILEGES; INSERT INTO accounts (username, pass) VALUES('testuser', PASSWORD('testpasswd'));
mkdir -p /home/vsftpd/testuser/www chmod a-w /home/vsftpd/testuser /etc/init.d/vsftpd restart