2013年10月1日 星期二

FTP伺服器-檔案傳輸的好幫手

檢查一下是不是已經有安裝vsftpd套件
[root@localhost ~]# rpm -qa | grep vsftpd
vsftpd-2.2.2-11.el6_4.1.x86_64

vsftpd安裝

[root@localhost ~]# yum install vsftpd -y

使用yum install會自動幫你安裝好,如果希望用tar方式來安裝的話可以至官網下載安裝

防火牆設定
[root@localhost ~]# setup




[root@localhost ~]# vi /etc/sysconfig/iptables

-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 21 -j ACCEPT

連接埠21預設為FTP協定的連接埠

最後重新啟動iptables跟vsftpd

[root@localhost ~]# service iptables restart
iptables: Flushing firewall rules:                         [  OK  ]
iptables: Setting chains to policy ACCEPT: filter          [  OK  ]
iptables: Unloading modules:                               [  OK  ]
iptables: Applying firewall rules:                         [  OK  ]
iptables: Loading additional modules: nf_conntrack_ftp     [  OK  ]

[root@localhost ~]# service vsftpd restart
Shutting down vsftpd:                                      [  OK  ]
Starting vsftpd for vsftpd:                                [  OK  ]

P.S以上步驟都做完之後FTP應該是可以連線了

如果還沒辦法連上FTP的話,請查看SELinux有沒有關掉

[root@localhost ~]# vi /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#       enforcing - SELinux security policy is enforced.
#       permissive - SELinux prints warnings instead of enforcing.
#       disabled - SELinux is fully disabled.
SELINUX=disabled   


沒有留言:

張貼留言