天天看點

centos ftp伺服器搭建_Centos7上搭建ftp伺服器

搭建過程中遇到一個問題,無法與ftp伺服器建立連接配接。查找原因後,存在兩點原因

  1. ftp配置打開ipv4連結。
  2. 防火牆限制端口。ftp伺服器使用21端口,在防火牆配置中打開該端口即可。

搭建步驟

  1. 使用YUM安裝

yum -y install vsftpd

  1. 配置檔案

/etc/vsftpd/路徑下會存在三個配置檔案

vsftpd.conf: 主配置檔案

ftpusers: 指定哪些使用者不能通路FTP伺服器,這裡的使用者包括root在内的一些重要使用者

user_list: 指定的使用者是否可以通路ftp伺服器

  1. 啟動vsftpd

    centos7使用systemctl管理服務

systemctl start vsftpd

  1. 檢視是否啟動

    檢查端口

netstat -ntlp|grep 21

centos ftp伺服器搭建_Centos7上搭建ftp伺服器
  1. 連接配接ftp伺服器
  • window下ftp指令連接配接

ftp 172.16.0.164

  • 使用工具fireZilla連接配接
centos ftp伺服器搭建_Centos7上搭建ftp伺服器
  1. 附加問題

連接配接ftp伺服器逾時,防火牆設定。可以關閉防火牆或者配置允許的端口

檢視防火牆狀态

systemctl list-unit-files|grep firewalld.service

關閉防火牆

systemctl stop firewalld.service

配置允許的端口

vim /etc/sysconfig/iptables

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

注意要加到reject之前

繼續閱讀