For Client

yum install ftp


For Server

Change iptables setting

  • vi /etc/sysconfig/iptables

# Accept FTP connection
-A INPUT -p tcp -m state --state NEW -m tcp --dport 21 -j ACCEPT

  • vi /etc/sysconfig/iptables-config

#For NAT ftp server only
IPTABLES_MODULES="ip_nat_ftp ip_conntrack_ftp"

  • /etc/init.d/iptables restart

Install vsftp

yum install vsftp

chkconfig vsftp on


For anonymous

#Enable anonymous write access for /var/ftp/uploads

vsftpd setting

  • vi /etc/vsftpd/vsftpd.conf

--------------------
anonymous_enable=YES
no_anon_password=YES
anon_max_rate=1000000       
data_connection_timeout=60  
idle_session_timeout=600    
max_clients=50              
max_per_ip=5

local_enable=NO
use_localtime=YES

dirmessage_enable=YES
xferlog_enable=YES
connect_from_port_20=YES
xferlog_std_format=YES
listen=YES
pam_service_name=vsftpd
tcp_wrappers=YES
banner_file=/etc/vsftpd/anon_welcome.txt

write_enable=YES
anon_other_write_enable=YES
anon_mkdir_write_enable=YES
anon_upload_enable=YES
--------------------

  • # Make folder to upload and change owner to anonymous(ftp)

mkdir /var/ftp/uploads
chown ftp /var/ftp/uploads

  • #Let anonymous can write file and mkdir folder

setsebool -P allow_ftpd_anon_write=1
setsebool -P allow_ftpd_full_access=1

 

Start the Server

  • /etc/init.d/vsftp start

For user account Only

vsftpd setting

  • vi /etc/vsftpd/vsftpd.conf

--------------------
anonymous_enable=NO

local_enable=YES
write_enable=YES
local_umask=002

userlist_enable=YES
userlist_deny=YES
userlist_file=/etc/vsftpd/user_list

use_localtime=YES
dirmessage_enable=YES
xferlog_enable=YES
connect_from_port_20=YES
xferlog_std_format=YES
listen=YES
pam_service_name=vsftpd
tcp_wrappers=YES
banner_file=/etc/vsftpd/welcome.txt
--------------------

  • #Login home folder for user

setsebool -P ftp_home_dir=1

Start the Server

  • /etc/init.d/vsftp start

文章標籤
創作者介紹
創作者 m1016c 的頭像
m1016c

Martin Chang的部落格

m1016c 發表在 痞客邦 留言(0) 人氣()