• Install
1
2
sudo apt install vsftpd apache2-utils libpam-pwdfile
sudo chown -R ftp:ftp /srv/ftp
  • Set password
1
2
3
4
5
# -c if it is first time
sudo htpasswd -b -B /etc/vsftpd/.passwd WHO-AM-I CHANGE-ME
# verify password
sudo htpasswd -v -b /etc/vsftpd/.passwd WHO-AM-I CHANGE-ME
sudo touch /etc/vsftpd/chroot_list
  • /etc/pam.d/vsftpd
1
2
auth required pam_pwdfile.so pwdfile /etc/vsftpd/.passwd
account required pam_permit.so
  • /etc/vsftpd/user_list(NO MORE SPACES)
1
WHO-AM-I
  • /etc/vsftpd.conf
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
pam_service_name=vsftpd
hide_ids=YES
anonymous_enable=NO
local_enable=YES
dirmessage_enable=YES

userlist_enable=YES
userlist_file=/etc/vsftpd/user_list
userlist_deny=NO

listen_port=21
pasv_min_port=12100
pasv_max_port=12200


vsftpd_log_file=/var/log/vsftpd.log
xferlog_std_format=NO
log_ftp_protocol=YES

guest_enable=YES
guest_username=ftp
virtual_use_local_privs=YES

chroot_local_user=YES
chroot_list_file=/etc/vsftpd/chroot_list
allow_writeable_chroot=YES
local_root=/srv/ftp/$USER
user_sub_token=$USER

write_enable=YES
local_umask=0022
file_open_mode=0644
utf8_filesystem=YES
  • nginx.conf
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
server {
    listen 80;

    root /srv/ftp;

    index index.html;

    server_name HOSTNAME;
    charset utf-8;

    location / {
        autoindex on;
    }
}