ubuntu:ftp:install_vsftpd_using_text_file_for_virtual_users
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
ubuntu:ftp:install_vsftpd_using_text_file_for_virtual_users [2019/12/05 00:54] – created peter | ubuntu:ftp:install_vsftpd_using_text_file_for_virtual_users [2020/07/15 09:30] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Ubuntu - FTP - Install vsftpd using text file for virtual users ====== | ====== Ubuntu - FTP - Install vsftpd using text file for virtual users ====== | ||
+ | |||
+ | ===== Install required packages ===== | ||
+ | |||
+ | <code bash> | ||
+ | sudo apt install vsftpd libpam-pwdfile | ||
+ | </ | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ===== Configure vsftpd ===== | ||
+ | |||
+ | Edit these variables in the config file and leave everything else with the default value. | ||
+ | |||
+ | <file bash / | ||
+ | anonymous_enable=NO | ||
+ | local_enable=YES | ||
+ | write_enable=YES | ||
+ | local_umask=022 | ||
+ | nopriv_user=vsftpd | ||
+ | virtual_use_local_privs=YES | ||
+ | guest_enable=YES | ||
+ | user_sub_token=$USER | ||
+ | local_root=/ | ||
+ | chroot_local_user=YES | ||
+ | hide_ids=YES | ||
+ | guest_username=vsftpd | ||
+ | </ | ||
+ | |||
+ | <WRAP info> | ||
+ | **NOTE:** Set the local_root to the parent directory where the user’s home directories are located. | ||
+ | </ | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ===== Configure PAM ===== | ||
+ | |||
+ | Configure PAM to check the passwd file for users. | ||
+ | |||
+ | <file bash / | ||
+ | auth required pam_pwdfile.so pwdfile / | ||
+ | account required pam_permit.so | ||
+ | </ | ||
+ | |||
+ | Make sure you remove everything else from the file. | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ===== Create the passwd file containing the users ===== | ||
+ | |||
+ | <code bash> | ||
+ | htpasswd -cd / | ||
+ | </ | ||
+ | |||
+ | You can later add additional users to the file like this: | ||
+ | |||
+ | <code bash> | ||
+ | htpasswd -d / | ||
+ | </ | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ===== Create a local user account to authenticate virtual users ===== | ||
+ | |||
+ | Create a local user that’s used by the virtual users to authenticate. | ||
+ | |||
+ | <code bash> | ||
+ | useradd --home / | ||
+ | </ | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ===== Restart vsftpd ===== | ||
+ | |||
+ | <code bash> | ||
+ | / | ||
+ | </ | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ===== Create home directory ===== | ||
+ | |||
+ | Create user’s home directory since vsftpd doesn’t do it automatically. | ||
+ | |||
+ | <code bash> | ||
+ | mkdir / | ||
+ | chown vsftpd: | ||
+ | chmod a-w / | ||
+ | </ | ||
ubuntu/ftp/install_vsftpd_using_text_file_for_virtual_users.1575507276.txt.gz · Last modified: 2020/07/15 09:30 (external edit)