This article will help configuring vsftpd using virtual users. Meaning there is no need to create system users, users can be maintanted using htpasswd. What is the benifit of using virtual users? this can be useful if you wish to auth same users via apache, where he / she can get access to same ftp files.
Download & install pam-pam_pwdfile.
Pam configuration
Append following lines in /etc/pam.d/vsftpd.pwd
auth required pam_listfile.so item=user sense=deny file=/etc/vsftpd/ftpusers onerr=succeed auth required pam_pwdfile.so pwdfile /etc/vsftpd_pwdfile # pam_pwdfile doesn't come with account, so we just permit, on success: account required pam_permit.so |
VSFtpd configuration
Following is the working config of vsftpd.conf
cat /etc/vsftpd/vsftpd.conf # we're running standalone listen=YES # enable virtual users: anonymous_enable=NO local_enable=YES guest_enable=YES # Where the accounts are located.. guest_username=ftp user_sub_token=$USER local_root=/home/userweb/store/$USER chroot_local_user=YES # allow writing write_enable=YES local_umask=022 virtual_use_local_privs=YES # some general options dirmessage_enable=YES hide_ids=YES connect_from_port_20=YES # here we define OUR pam config [see below] pam_service_name=vsftpd.pwd # more verbose logging xferlog_enable=YES log_ftp_protocol=YES setproctitle_enable=YES #banner ftpd_banner="Welcome..." |
Users creation
create new pwdfile & user
htpasswd -c -b /etc/vsftpd_pwdfile username password |
Pingback: pligg.com