This is an old revision of the document!
Installing
1 2 |
yum install vsftpd chkconfig vsftpd on |
Configuring /etc/vsftpd/vsftpd.conf
You should edit your /etc/vsftpd/vsftpd.conf file similar to the following:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
anonymous_enable=NO local_enable=YES write_enable=YES local_umask=022 dirmessage_enable=YES xferlog_enable=YES connect_from_port_20=YES xferlog_std_format=YES listen=YES pam_service_name=vsftpd userlist_enable=YES tcp_wrappers=YES # the below lines may need to be manually added pasv_min_port=60000 pasv_max_port=65000 |
Chrooting User
If you would like to chroot the users you can add the following line to the bottom of /etc/vsftpd/vsftpd.conf
#for chrooting users add the following lines:
1 2 3 |
chroot_local_user=NO chroot_list_enable=NO chroot_list_file= /etc/vsftpd/vsftpd .chroot_list |
Note: you will need to create the file even if you leave it empty
1 |
/etc/vsftpd/vsftpd .chroot_list |
1 |
service vsftpd start |
Firewall Rules:
1 2 3 |
iptables -I INPUT -p tcp --dport 21 -m comment -comment "FTP" -j ACCEPT iptables -I INPUT -p tcp -m multiport --dports 60000:65000 -m comment -comment "FTP passive mode ports" -j ACCEPT |
1 |
/etc/init .d /iptables save |
1 |
IPTABLES_MODULES= "nf_conntrack_ftp" |
Adding and modifying Users
useradd -m -s /sbin/nologin username will create a user without the access to ssh into the server which is more secure if the user is only being used for FTP (they will still be able to user FTP + vsFTPd, NOT sFTP)
useradd –d /home/directory/ username this adds a user with a specific home directory. This is good for chrooting a user to a specific directory.
Adding a new user straight into a group useradd -G {group-name} username
Alternivately you are able to use the following command to add a new user straight into a group you have created with a home directory of /var/www/html and NO shell login (only useable as FTP user)
1 |
useradd -G groupname -home /var/www/testftp/ -m -s /sbin/nologin newusername |
1 |
passwd username |