- Create user account, create directory for user account, and assign permissions to the user account
- Create a directory for Virtual User accounts' VSFTPD permissions. Each user account's permissions can be customized in this folder (we will do this later on in step 7)
- Backup Vsftpd.conf and edit Vstfpd.conf to enable local users, PAM service, enable guest, and define where our Virtual User account permissions are located
- Edit pam.d vsftpd file
- Create login text file
- Create login database for PAM to read and encrypt it
- Create a template settings file for Virtual User account permissions in step 2
- Use the template to create our user's permissions
- Edit our user's permission to define home and guest username
- Restart Vsftpd
- Put on our sunglasses and relax under the sun
# Must use -d option
sudo useradd -d /home/genesis genesis
sudo mkdir /home/genesis
sudo chown genesis /home/genesis
sudo mkdir /etc/vsftpd
sudo mkdir /etc/vsftpd/vusers
sudo nano /etc/vsftpd.conf
anonymous_enable=NO
local_enable=YES
pam_service_name=vsftpd
guest_enable=YES
user_config_dir=/etc/vsftpd/vusers
sudo nano /etc/pam.d/vsftpd
# Standard behaviour for ftpd(8).
auth required pam_listfile.so item=user sense=deny file=/etc/ftpusers onerr=succeed
# Note: vsftpd handles anonymous logins on its own. Do not enable
# pam_ftp.so.
# Standard blurb.
#@include common-account
@include common-session
#@include common-auth
#auth required pam_shells.so
# Added per the readme to enable virtual users.
auth required /lib/security/pam_userdb.so db=/etc/vsftpd_login
account required /lib/security/pam_userdb.so db=/etc/vsftpd_login
sudo nano login.txt
genesis
genesispasswordgoeshere
someotheruser
someotheruserpasswordgoeshere
sudo db3_load -T -t hash -f login.txt /etc/vsftpd/vsftpd_login.db
sudo chmod 600 /etc/vsftpd/vsftpd_login.db
#The following is not a safe solution
#because if the file is compromised, all
#of your user/passwords will be compromised,
#but on the other hand, it will be easier
#to update future users you wish to add to
#your server. You should delete this with
#"sudo rm login.txt" without quotes
sudo chmod 600 /etc/vsftpd/login.txt
sudo nano /etc/vsftpd/vusers/template1forusers
write_enable=YES
anon_mkdir_write_enable=YES
anon_other_write_enable=YES
anon_upload_enable=YES
local_root=/home/???
chroot_local_user=YES
dirlist_enable=YES
download_enable=YES
guest_username=???
sudo nano /etc/vsftpd/vusers/template1forusers
write_enable=YES
anon_mkdir_write_enable=YES
anon_other_write_enable=YES
anon_upload_enable=YES
local_root=/home/genesis
chroot_local_user=YES
dirlist_enable=YES
download_enable=YES
guest_username=genesis
it give 530 error
ReplyDelete