How to build the FTP Server quicly with 「vsftpd」?
Install service 「vsftpd」#
In ubuntu, you just need to run the following command for installation:
1apt-get install vsftpd -y
Configure the vsftpd#
You can find the config file of vsftpd in /etc/vsftpd.conf or /etc/vsftpd/vsftpd.conf probably.
There have many settings, but mostly the options you only need to care are below:
anonymous_enable- If you want that the ftp is allow to connect by anonymous user, change it toYES.(NOT Recommended)write_enable- Set it toYESto make the user writeable.allow_writeable_chroot- Set it toYESto allow the user writeable inhome directory.chroot_local_user- When the option is set toYES, it means that the user can only access their home directory.chroot_list_enable,chroot_list_file- These options usually work withchroot_local_useras anexception.- If
chroot_local_user=YES- If
chroot_list_enable=YES- This means all users are restricted to their home directory except the users inchroot_list_file. - If
chroot_list_enable=NO- This means all users are restricted to their home directory and no exception.
- If
- If
chroot_local_user=NO- If
chroot_list_enable=YES- This means all users are NOT restricted to their home directory except the users inchroot_list_file. - If
chroot_list_enable=NO- This means all users are NOT restricted to their home directory and no exception.
- If
chroot_list_file=/etc/vsftpd/chroot_list- This option is setting where the chroot list file is, and the content of file looks like following:root, user1, user2
- If
pam_service_name=ftp- The default value isvsftpd, but if you are setting the shell/usr/sbin/nologinto the ftp users, it’s gonna be not working probably. (ps. pls search by google for details)userlist_enable- If set it toYESmeans can only the specific users be login in vsftpd.userlist_deny- Opposite ofuserlist_enableoption, if set it toYESmeans all users are allow to login in vsftpd except the specific users.userlist_file=/etc/vsftpd/user_list- Setting where is the file for specific users in two above options.
Restart the service#
Don’t forget to restart the service so it can run in the new configuration.
1service vsftpd restart