Site Tools


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-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

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
setting-up-vsftpd [2018/12/21 09:45]
171.78.140.145 created
setting-up-vsftpd [2018/12/21 10:29] (current)
171.78.140.145
Line 1: Line 1:
 ====== Setting up VSFTPD with MySQL ====== ====== Setting up VSFTPD with MySQL ======
 +
 +===== Install PAM MySQL module =====
 +
 +<​code>​
 +sudo apt-get install libpam-mysql
 +</​code>​
 +
 +===== Create a database to store usernames and passwords =====
 +
 +<​code>​
 +CREATE DATABASE ftp;
 +GRANT ALL PRIVILEGES ON ftp.* TO '​ftp-admin'​@'​localhost'​ IDENTIFIED BY '​f7p@dm1n';​
 +FLUSH PRIVILEGES;
 +</​code>​
 +
 +===== Edit /​etc/​vsftpd.conf =====
 +
 +<​code>​
 +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
 +</​code>​
 +
 +===== Configure the PAM module =====
 +
 +<​code>​
 +sudo vi /​etc/​pam.d/​vsftpd
 +</​code>​
 +
 +The contents of the file should be
 +<​code>​
 +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
 +</​code>​
 +
 +===== Create users =====
 +
 +<​code>​
 +insert into accounts(username,​ password) values('​hari',​ PASSWORD('​haripriya'​));​
 +</​code>​
 +
 +===== Create user-specific directories =====
 +
 +<​code>​
 +sudo mkdir /​srv/​ftp/​hari
 +sudo chown ftp:ftp /​srv/​ftp/​hari
 +</​code>​
 +
 +===== Restart VSFPTD =====
 +<​code>​
 +sudo systemctl restart vsftpd
 +</​code>​
  
setting-up-vsftpd.1545365749.txt.gz ยท Last modified: 2018/12/21 09:45 by 171.78.140.145