天天看点

Fedora20下FTP服务器的安装(vsftpd)

最简单的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]# 
           

继续阅读