[root@localhost ~]# yum install vsftpd
2, changing default directory on vsftpd server
add this line to the end of conf file: /etc/vsftpd/vsftpd.conf
[root@localhost greg]# vim /etc/vsftpd/vsftpd.conf
......
local_root=/home/greg/
3, start ftp server
[root@localhost ~]# /etc/init.d/vsftpd start
4, add new ftp user
a, All ftp user must already be a system user with a valid password.
So, if you want to create user 'greg'
do:
adduser greg
passwd greg
b, edit conf file: /etc/vsftpd/vsftpd.conf
Uncomment these two lines:
chroot_list_enable=YES
# (default follows)
chroot_list_file=/etc/vsftpd/chroot_list
c: add user 'greg' to chroot_list
[root@localhost chang]# vim /etc/vsftpd/chroot_list
greg
"/etc/vsftpd/chroot_list" 1L, 6C
5, restart ftp server
[root@localhost ~]# /etc/init.d/vsftpd restart
6.1 Config firewall
You may need to open port 21 for FTP in your iptables
#ftp -A RH-Firewall-1-INPUT -p TCP -i eth0 --dport 21 -m state --state NEW -j ACCEPT -A RH-Firewall-1-INPUT -p ALL -i eth0 -m state --state ESTABLISHED,RELATED -j ACCEPT -A OUTPUT -p ALL -o eth0 -m state --state ESTABLISHED,RELATED -j ACCEPT
6.2 Config firewall config
Add ip_conntrack ip_conntrack_ftp in this line
IPTABLES_MODULES="ip_conntrack_netbios_ns ip_conntrack ip_conntrack_ftp"
6.3 Run following commands
[root@test2 html]# modprobe ip_conntrack_ftp
superb, this works for me. very easy to understand. thanks.
ReplyDelete