centos 安装 vftpd
安装vsftpd
1 | # 查看当前系统版本 |
基于虚拟用户的配置
所谓虚拟用户就是没有使用真实的帐户,只是通过映射到真实帐户和设置权限的目的。虚拟用户不能登录CentOS系统。
修改配置文件
1 | # vim /etc/vsftpd/vsftpd.conf |
用户认证管理
1 | #安装Berkeley DB工具,很多人找不到db_load的问题就是没有安装这个包 |
设置FTP根目录权限
1 | #最新的vsftpd要求对主目录不能有写的权限所以ftp为755,主目录下面的子目录再设置777权限 |
设置iptable开放21端口
1 | # vim /etc/sysconfig/iptables |
常见问题
553 Could not create file
1 | 1、首先确保你的FTP目录 文件是可写的,ls -l 可以查看 如果不是则 chmod 777 ftpd目录 |
但重启后又恢复
为解决,需要修改/etc/sysconfig/iptables-config文件1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24# vim /etc/sysconfig/iptables-config
# Load additional iptables modules (nat helpers)
# Default: -none-
# Space separated list of nat helpers (e.g. 'ip_nat_ftp ip_nat_irc'), which
# are loaded after the firewall rules are applied. Options for the helpers are
# stored in /etc/modprobe.conf.
IPTABLES_MODULES=""
# Unload modules on restart and stop
# Value: yes|no, default: yes
# This option has to be 'yes' to get to a sane state for a firewall
# restart or stop. Only set to 'no' if there are problems unloading netfilter
# modules.
IPTABLES_MODULES_UNLOAD="yes"
IPTABLES_MODULES_UNLOAD="yes"的意义:每次iptables停止或者重启都会Unload modules
IPTABLES_MODULES=""的意义:每次防火墙规则应用以后加载的模块
我们需要把
IPTABLES_MODULES=""
修改为:
IPTABLES_MODULES="ip_nat_ftp"
这样重启服务器之后就不必再每次都执行mobprobe啦