vsftp软件是我们常见的FTP服务器搭建软件,所有的配置都是基于/etc/vsftpd/vsftpd.conf这个配置文件的。vsftpd.conf里面主要包括安全配置,传输,用户还有权限等相关的选项。下面详细介绍关于vsftp服务器的配置文件
CentOS 7中的vsftpd.conf配置文件
# Example config file /etc/vsftpd/vsftpd.conf
#
# The default compiled in settings are fairly paranoid. This sample file
# loosens things up a bit, to make the ftp daemon more usable.
# Please see vsftpd.conf.5 for all compiled in defaults.
#
# READ THIS: This example file is NOT an exhaustive list of vsftpd options.
# Please read the vsftpd.conf.5 manual page to get a full idea of vsftpd's
# capabilities.
#
# Allow anonymous FTP? (Beware - allowed by default if you comment this out).
anonymous_enable=YES <==设置是否允许匿名用户登录FTP服务器。默认为YES
#
# Uncomment this to allow local users to log in.
# When SELinux is enforcing check for SE bool ftp_home_dir
local_enable=YES <==是否允许本地用户登录FTP服务器。默认为NO
#
# Uncomment this to enable any form of FTP write command.
write_enable=YES <==是否对登录用户开启写权限。属全局性设置。默认NO
#
# Default umask for local users is 077. You may wish to change this to 022,
# if your users expect that (022 is used by most other ftpd's)
local_umask=022 <==设置本地用户的文件生成umask为022。默认是077
#
# Uncomment this to allow the anonymous FTP user to upload files. This only
# has an effect if the above global write enable is activated. Also, you will
# obviously need to create a directory writable by the FTP user.
# When SELinux is enforcing check for SE bool allow_ftpd_anon_write, allow_ftpd_full_access
#anon_upload_enable=YES <==是否允许匿名用户上传文件,默认为NO
#
# Uncomment this if you want the anonymous FTP user to be able to create
# new directories.
#anon_mkdir_write_enable=YES <==是否允许匿名用户创建目录,默认为NO
#
# Activate directory messages - messages given to remote users when they
# go into a certain directory.
dirmessage_enable=YES <==设置是否显示目录消息。若设置为YES,进入目录时候将显示该目录中message_file配置文件(.message)中的内容
#
# Activate logging of uploads/downloads.
xferlog_enable=YES <==是否启用FTP上传或下载日志记录。默认为NO
#
# Make sure PORT transfer connections originate from port 20 (ftp-data).
connect_from_port_20=YES <==是够允许主动模式FTP,默认为NO
#
# If you want, you can arrange for uploaded anonymous files to be owned by
# a different user. Note! Using "root" for uploaded files is not
# recommended!
#chown_uploads=YES <==用于设置是否改变匿名用户上传的文档的属主。默认为NO。
#chown_username=whoever <==设置匿名用户上传的文档的属主名。只有chown_uploads=YES时才有效。默认为root(建议不要为root用户)
#
# You may override where the log file goes if you like. The default is shown
# below.
#xferlog_file=/var/log/xferlog <==设置日志文件名及路径。需启用xferlog_enable选项
#
# If you want, you can have your log file in standard ftpd xferlog format.
# Note that the default log file location is /var/log/xferlog in this case.
xferlog_std_format=YES <==日志文件是否使用标准的xferlog日志文件格式(与wu-ftpd使用的格式相同) 。默认为NO
#
# You may change the default value for timing out an idle session.
#idle_session_timeout=600 <==设置多长时间不对FTP服务器进行任何操作,则断开该FTP连接,单位为秒,默认为300
#
# You may change the default value for timing out a data connection.
#data_connection_timeout=120 <==设置建立FTP数据连接的超时时间,默认为300秒。
#
# It is recommended that you define on your system a unique user which the
# ftp server can use as a totally isolated and unprivileged user.
#nopriv_user=ftpsecure <==运行vsftpd需要的非特权系统用户,默认是nobody
#
# Enable this and the server will recognise asynchronous ABOR requests. Not
# recommended for security (the code is non-trivial). Not enabling it,
# however, may confuse older FTP clients.
#async_abor_enable=YES <==是否识别异步ABOR请求
#
# By default the server will pretend to allow ASCII mode but in fact ignore
# the request. Turn on the below options to have the server actually do ASCII
# mangling on files when in ASCII mode.
# Beware that on some FTP servers, ASCII support allows a denial of service
# attack (DoS) via the command "SIZE /big/file" in ASCII mode. vsftpd
# predicted this attack and has always been safe, reporting the size of the
# raw file.
# ASCII mangling is a horrible feature of the protocol.
#ascii_upload_enable=YES <==设置是否启用ASCII模式下载数据。默认为NO。
#ascii_download_enable=YES <==设置是否启用ASCII模式上传数据。默认为NO。
#
# You may fully customise the login banner string:
#ftpd_banner=Welcome to blah FTP service. <==该配置项用于设置比较简短的欢迎信息。若欢迎信息较多,则可使用banner_file配置项
#
# You may specify a file of disallowed anonymous e-mail addresses. Apparently
# useful for combatting certain DoS attacks.
#deny_email_enable=YES <==黑名单设置。如果很讨厌某些email address,就可以使用此设定来取消他的登录权限
# (default follows)
#banned_email_file=/etc/vsftpd/banned_emails <==当deny_email_enable=YES时,可以利用这个设定项来规定哪些邮件地址不可登录vsftpd服务器
#
# You may specify an explicit list of local users to chroot() to their home
# directory. If chroot_local_user is YES, then this list becomes a list of
# users to NOT chroot().
# (Warning! chroot'ing can be very dangerous. If using chroot, make sure that
# the user does not have write access to the top level directory within the
# chroot)
#chroot_local_user=YES <==是否将实体用户限制在自己的家目录内,默认为NO
#chroot_list_enable=YES <==设置是否启用chroot_list_file配置项指定的用户列表文件,默认为NO
# (default follows)
#chroot_list_file=/etc/vsftpd/chroot_list <==用于指定用户列表文件,该文件用于控制哪些用户限制在家目录
#
# You may activate the "-R" option to the builtin ls. This is disabled by
# default to avoid remote users being able to cause excessive I/O on large
# sites. However, some broken FTP clients such as "ncftp" and "mirror" assume
# the presence of the "-R" option, so there is a strong case for enabling it.
#ls_recurse_enable=YES <==是否允许递归查询。默认为NO,以防止远程用户造成过量的I/O
#
# When "listen" directive is enabled, vsftpd runs in standalone mode and
# listens on IPv4 sockets. This directive cannot be used in conjunction
# with the listen_ipv6 directive.
listen=NO <==设置vsftpd服务器是否以standalone模式运行,默认为NO
#
# This directive enables listening on IPv6 sockets. By default, listening
# on the IPv6 "any" address (::) will accept connections from both IPv6
# and IPv4 clients. It is not necessary to listen on *both* IPv4 and IPv6
# sockets. If you want that (perhaps because you want to listen on specific
# addresses) then you must run two copies of vsftpd with two configuration
# files.
# Make sure, that one of the listen options is commented !!
listen_ipv6=YES <==是否监听ipv6地址,默认为NO
pam_service_name=vsftpd <==设置在PAM所使用的名称,默认值为vsftpd
userlist_enable=YES <==决定/etc/vsftpd/user_list文件是否启用生效。YES则生效,NO不生效
tcp_wrappers=YES <==用来设置vsftpd服务器是否与tcp wrapper相结合,进行主机的访问控制
除此之外,还有一些其它常用的控制选项
use_localtime=YES <==是否使用本地时间,默认为NO(默认使用GMT时间)
listen_port=21 <==vsftpd的端口号,默认为21
pasv_enable=YES <==是否启用数据的被动模式连接,默认为YES
pasv_min_port=0 <==设置FTP被动模式连接的最小端口。默认为0,表示不受限制
pasv_max_port=0 <==设置FTP被动模式连接的最大端口。默认为0,表示不受限制
connect_timeout=60 <==PORT方式下建立数据连接的超时时间,单位为秒 ,默认为60
accept_timeout=60 <==被动(PASV)数据连接的超时时间,单位为秒,默认值为60
max_clients=0 <==vsftpd允许每个客户端的最大连接数,默认为0,表示不受限制
max_per_ip=0 <==vsftpd允许每个IP的最大连接数,默认为0,表示不受限制
local_max_rate=0 <==本地用户所能使用的最大传输速度。默认为0,表示不受限制
anon_max_rate=0 <==匿名用户所能使用的最大传输速度。默认为0,表示不受限制
anon_world_readable_only=YES <==仅允许匿名用户具有下载可读文件的权限,默认为YES
anon_other_write_enable=YES <==是否允许匿名用户具有除了写之外的权限,包括删除与修改文件和目录,默认为NO
ftp_username=ftp <==定义匿名用户的账户名称,默认值为ftp。
no_anon_password=YES <==匿名用户登录时是否询问口令。设置为YES,则询问。默认NO
anon_umask=022 <==设置匿名用户新增文档的umask。默认077
userlist_enable和userlist _deny选项不同时
userlist_enable=YES && userlist_deny=YES <==/etc/vsftpd/user_list中的用户禁止访问
userlist_enable=YES && userlist_deny=NO <==/etc/vsftpd/user_list中的用户允许访问
注意:/etc/vsftpd/ftpuser不受任何配制项的影响,它总是有效,它是一个黑名单。当userlist_enable=YES时,userlist_deny选项才会生效。当userlist_enable=YES,userlist_deny=YES时,user_list是一个黑名单;当userlist_enable=YES,userlist_deny=NO时,user_list是一个白名单。需要提醒的是,使用白名单后,匿名用户将无法登入!除非显式在user_list中加入一行:anonymous