最簡單的FTP伺服器端安裝方法。
1. 指令清單
yum -y install vsftpd # 安裝伺服器
vim vsftpd.conf # 修改配置檔案,在Fedora20中,不修改也可以用
systemctl start vsftpd # 啟動FTP服務
systemctl enable vsftpd # 将FTP服務加入自動啟動
2. 本次安裝基于以下系統環境
[[email protected] ~]# lsb_release -a
LSB Version: :core-4.1-amd64:core-4.1-noarch:cxx-4.1-amd64:cxx-4.1-noarch:desktop-4.1-amd64:desktop-4.1-noarch:languages-4.1-amd64:languages-4.1-noarch:printing-4.1-amd64:printing-4.1-noarch
Distributor ID: Fedora
Description: Fedora release 20 (Heisenbug)
Release: 20
Codename: Heisenbug
[[email protected] ~]#
3. 執行過程記錄
[[email protected] ~]# yum -y install vsftpd
已加載插件:axelget, fastestmirror, langpacks, refresh-packagekit
......
Running transaction (shutdown inhibited)
正在安裝 : vsftpd-3.0.2-6.fc20.x86_64 1/1
驗證中 : vsftpd-3.0.2-6.fc20.x86_64 1/1
已安裝:
vsftpd.x86_64 0:3.0.2-6.fc20
完畢!
[[email protected] ~]# cd /etc/vsftpd/
[[email protected] vsftpd]# ll
總用量 20
-rw-------. 1 root root 125 9月 10 2013 ftpusers
-rw-------. 1 root root 361 9月 10 2013 user_list
-rw-------. 1 root root 5030 9月 10 2013 vsftpd.conf #設定檔案
-rwxr--r--. 1 root root 338 9月 10 2013 vsftpd_conf_migrate.sh
[[email protected] vsftpd]# cp -p vsftpd.conf vsftpd.conf.20141011
[[email protected] vsftpd]# vim vsftpd.conf
[[email protected] vsftpd]# diff vsftpd.conf vsftpd.conf.20141011 #我隻是将權限減小了。禁止匿名使用者,對于一味放開權限的大神。請參考下面的設定清單
12c12
< anonymous_enable=NO
---
> anonymous_enable=YES
[[email protected] vsftpd]# systemctl enable vsftpd
ln -s '/usr/lib/systemd/system/vsftpd.service' '/etc/systemd/system/multi-user.target.wants/vsftpd.service'
[ro[email protected] vsftpd]# systemctl start vsftpd
[[email protected] vsftpd]#
4. 設定檔案中,可以設定的參數
anonymous_enable=YES #允許匿名通路
local_enable=YES #允許本地使用者通路(/etc/passwd中的使用者)
write_enable=YES #允許寫入權限,包括修改,删除
anon_upload_enable=YES #允許匿名使用者上傳
anon_mkdir_write_enable=YES #允許匿名使用者建立目錄
ascii_upload_enable=YES #允許ascii上傳
ascii_download_enable=YES #允許ascii下載下傳
5. 伺服器端的設定(2014年10月27日修訂:增加)
[[email protected] densintian]# setsebool -P ftp_home_dir 1
[[email protected] densintian]# setsebool -P ftpd_full_access 1
[[email protected] densintian]# grep vsftpd /var/log/audit/audit.log | audit2allow -M mypol
******************** IMPORTANT ***********************
To make this policy package active, execute:
semodule -i mypol.pp
[[email protected] densintian]# semodule -i mypol.pp
[[email protected] densintian]#