在CentOS7系統上安裝配置vsftp簡要手冊

前言

CentOS7由於systemd取代了init,因此在配置方面和6有些不一樣,這篇用簡潔的語言描述如何在7上開啓ftp。python

安裝

一般安裝好系統以後, vsftp已經安裝好了,只須要啓動一下服務就好。
若是沒有安裝,則建議經過yum來安裝centos

harriszh# yum search vsftp
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: ftpmirror.your.org
 * epel: ftp.kddilabs.jp
 * extras: mirror.scalabledns.com
 * updates: mirror.scalabledns.com
=============================================================================================== N/S matched: vsftp ================================================================================================
vsftpd-sysvinit.x86_64 : SysV initscript for vsftpd daemon
vsftpd.x86_64 : Very Secure Ftp Daemon

而後就能夠經過yum install vsftpd.x86_64來進行安裝app

配置

配置文件在/etc/vsftp/vsftp.conf裏
通常我只修改ui

ascii_upload_enable=YES
ascii_download_enable=YES

其餘保持默認
更復雜的配置請參考vsftp的文檔spa

開啓服務

在CentOS7中最顯著的變化就是使用systemd來代替init進行啓動和服務管理。因此相應命令改成命令行

systemctl start vsftp

若是有問題能夠經過systemctl status vsftpd來查看scala

l status vsftpd
● vsftpd.service - Vsftpd ftp daemon
   Loaded: loaded (/usr/lib/systemd/system/vsftpd.service; disabled; vendor preset: disabled)
   Active: active (running) since 六 2018-05-19 22:10:41 CST; 45min ago
  Process: 33471 ExecStart=/usr/sbin/vsftpd /etc/vsftpd/vsftpd.conf (code=exited, status=0/SUCCESS)
 Main PID: 33473 (vsftpd)
    Tasks: 1
   CGroup: /system.slice/vsftpd.service
           └─33473 /usr/sbin/vsftpd /etc/vsftpd/vsftpd.conf

5月 19 22:10:41 centos-harriszh systemd[1]: Starting Vsftpd ftp daemon...
5月 19 22:10:41 centos-harriszh systemd[1]: Started Vsftpd ftp daemon.

防火牆

開啓服務後,默認其餘機器仍是沒法訪問,一般緣由都是由於防火牆
在CentOS7中,能夠安裝firewall-config來進行界面化的配置code

centos-harriszh# yum search firewall
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: ftpmirror.your.org
 * epel: ftp.kddilabs.jp
 * extras: mirror.scalabledns.com
 * updates: mirror.scalabledns.com
============================================================================================== N/S matched: firewall ==============================================================================================
fail2ban-firewalld.noarch : Firewalld support for Fail2Ban
firewall-applet.noarch : Firewall panel applet
firewall-config.noarch : Firewall configuration application
firewalld.noarch : A firewall daemon with D-Bus interface providing a dynamic firewall
firewalld-filesystem.noarch : Firewalld directory layout and rpm macros
puppet-firewalld.noarch : A Puppet module for FirewallD
python-firewall.noarch : Python2 bindings for firewalld
system-config-firewall.noarch : A graphical interface for basic firewall setup
system-config-firewall-base.noarch : system-config-firewall base components and command line tool
system-config-firewall-tui.noarch : A text interface for basic firewall setup
perl-IPTables-Parse.noarch : Perl extension for parsing iptables firewall rulesets
shorewall.noarch : An iptables front end for firewall configuration
shorewall-lite.noarch : Shorewall firewall for compiled rulesets
shorewall6.noarch : Files for the IPV6 Shorewall Firewall
shorewall6-lite.noarch : Shorewall firewall for compiled IPV6 rulesets
ufw.noarch : Uncomplicated Firewall

  Name and summary matches only, use "search all" for everything.
centos-harriszh# yum install firewall-config.noarch

而後在命令行輸入firewall-config就能夠打開界面了
firewall-config
如上圖所示在configuration處選擇Permanent, 而後在trusted裏把ftp勾選上就好了component

總結

作完以上步驟,應該就能夠在其餘機器上用lftp登陸到本機,並如同在本機上訪問目錄了blog

相關文章
相關標籤/搜索