Site Tools


Hotfix release available: 2024-02-06b "Kaos". upgrade now! [55.2] (what's this?)
Hotfix release available: 2024-02-06a "Kaos". upgrade now! [55.1] (what's this?)
New release available: 2024-02-06 "Kaos". upgrade now! [55] (what's this?)
Hotfix release available: 2023-04-04b "Jack Jackrum". upgrade now! [54.2] (what's this?)
Hotfix release available: 2023-04-04a "Jack Jackrum". upgrade now! [54.1] (what's this?)
New release available: 2023-04-04 "Jack Jackrum". upgrade now! [54] (what's this?)
Hotfix release available: 2022-07-31b "Igor". upgrade now! [53.1] (what's this?)
Hotfix release available: 2022-07-31a "Igor". upgrade now! [53] (what's this?)
New release available: 2022-07-31 "Igor". upgrade now! [52.2] (what's this?)
New release candidate 2 available: rc2022-06-26 "Igor". upgrade now! [52.1] (what's this?)
New release candidate available: 2022-06-26 "Igor". upgrade now! [52] (what's this?)
Hotfix release available: 2020-07-29a "Hogfather". upgrade now! [51.4] (what's this?)
New release available: 2020-07-29 "Hogfather". upgrade now! [51.3] (what's this?)
New release candidate 3 available: 2020-06-09 "Hogfather". upgrade now! [51.2] (what's this?)
New release candidate 2 available: 2020-06-01 "Hogfather". upgrade now! [51.1] (what's this?)
New release candidate available: 2020-06-01 "Hogfather". upgrade now! [51] (what's this?)
Hotfix release available: 2018-04-22c "Greebo". upgrade now! [50.3] (what's this?)
Hotfix release available: 2018-04-22b "Greebo". upgrade now! [50.2] (what's this?)
setting-up-vsftpd

Setting up VSFTPD with MySQL

Install PAM MySQL module

sudo apt-get install libpam-mysql

Create a database to store usernames and passwords

CREATE DATABASE ftp;
GRANT ALL PRIVILEGES ON ftp.* TO 'ftp-admin'@'localhost' IDENTIFIED BY 'f7p@dm1n';
FLUSH PRIVILEGES;

Edit /etc/vsftpd.conf

listen=YES
anonymous_enable=NO
local_enable=YES
write_enable=YES
local_umask=022
dirmessage_enable=YES
xferlog_enable=YES
connect_from_port_20=YES
nopriv_user=ftp
chroot_local_user=YES
secure_chroot_dir=/var/run/vsftpd
pam_service_name=vsftpd
rsa_cert_file=/etc/ssl/certs/vsftpd.pem
guest_enable=YES
guest_username=ftp
local_root=/srv/ftp/$USER
user_sub_token=$USER
virtual_use_local_privs=YES
user_config_dir=/etc/vsftpd_user_conf

Configure the PAM module

sudo vi /etc/pam.d/vsftpd

The contents of the file should be

auth required pam_mysql.so user=ftp passwd=f7p@dm1n host=localhost db=ftp table=accounts usercolumn=username passwdcolumn=password crypt=2
account required pam_mysql.so user=ftp passwd=f7p@dm1n host=localhost db=ftp table=accounts usercolumn=username passwdcolumn=password crypt=2

Create users

insert into accounts(username, password) values('hari', PASSWORD('haripriya'));

Create user-specific directories

sudo mkdir /srv/ftp/hari
sudo chown ftp:ftp /srv/ftp/hari

Restart VSFPTD

sudo systemctl restart vsftpd
setting-up-vsftpd.txt · Last modified: 2018/12/21 10:29 by 171.78.140.145