热门关键字:  ubuntu  分区  函数  Fedora  linux系统进程

vsftp配置大全---超完整版

来源: 作者: 时间:2007-12-21 Tag: 点击:

data_connection_timeout
超时,单位:秒。设定数据传输延迟的最大时间。时间一到,远程用户将被断开连接。
默认值:300

file_open_mode
对于上传的文件设定权限。如果你想被上传的文件可被执行,umask要改成0777。
默认值:0666

ftp_data_port
设定PORT模式下的连接端口(只要connect_from_port_20被激活)。
默认值:20

idle_session_timeout
超时。单位:秒。设置远程客户端在两次输入FTP命令间的最大时间。时间一到,远程客户将被断开连接。
默认值:300

listen_port
如果vsftpd处于独立运行模式,这个端口设置将监听的FTP连接请求。
默认值:21

local_max_rate
为本地认证用户设定最大传输速度,单位:字节/秒。
默认值:0(无限制)

local_umask
设置本地用户创建的文件的权限。注意:如果你想输入8进制的值,那么其中的0不同于10进制的0。
默认值:077

max_clients
如果vsftpd运行在独立运行模式,这里设置了容许连接的最大客户端数。再后来的用户端将得到一个错误信息。
默认值:0(无限制)

max_per_ip
如果vsftpd运行在独立运行模式,这里设置了容许一个IP地址的最大接入客户端。如果超过了最大限制,将得到一个错误信息。
默认值:0(无限制)

pasv_max_port
指定为被动模式数据连接分配的最大端口。可用来指定一个较小的范围以配合防火墙。
默认值:0(使用任何端口)

pasv_min_port
指定为被动模式数据连接分配的最小端口。可用来指定一个较小的范围以配合防火墙。
默认值:0(使用任何端口)

trans_chunk_size
你一般不需要改这个设置。但也可以尝试改为如8192去减小带宽限制的影响。
默认值:0(让vsftpd自行选择)

===========
STRING 配置项
以下是STRING 配置项

anon_root
设置一个目录,在匿名用户登录后,vsftpd会尝试进到这个目录下。如果失败则略过。
默认值:无

banned_email_file
deny_email_enable启动后,匿名用户如果使用这个文件里指定的E-MAIL密码登录将被拒绝。
默认值:/etc/vsftpd.banned_emails

banner_file
设置一个文本,在用户登录后显示文本内容。如果你设置了ftpd_banner,ftpd_banner将无效。
默认值:无

chown_username
改变匿名用户上传的文件的所有者。需设定chown_uploads。
默认值:ROOT

chroot_list_file
这个项提供了一个本地用户列表,表内的用户登录后将被放在虚根下,并锁定在home目录。这需要chroot_list_enable项被启用。
如果chroot_local_user项被启用,这个列表就变成一个不将列表里的用户锁定在虚根下的用户列表了。
默认值:/etc/vsftpd.chroot_list

cmds_allowed
以逗号分隔的方式指定可用的FTP命令(post login. USER, PASS and QUIT 是始终可用的命令)。
其他命令将被屏蔽。这是一个强有力的locking down一个FTP服务器的手段。例如:cmds_allowed=PASV,RETR,QUIT
默认值:无

deny_file
这可以设置一个文件名或者目录名式样以阻止在任何情况下访问它们。并不是隐藏它们,而是拒绝任何试图对它们进行的操作(下载,改变目录层,
和其他有影响的操作)。这个设置很简单,而且不会用于严格的访问控制-文件系统权限将优先生效。然而,这个设置对确定的虚拟用户设置很有用。
特别是如果一个文件能多个用户名访问的话(可能是通过软连接或者硬连接),那就要拒绝所有的访问名。
建议你为使用文件系统权限设置一些重要的安全策略以获取更高的安全性。如deny_file={*.mp3,*.mov,.private}
默认值:无

dsa_cert_file
这个设置为SSL加密连接指定了DSA证书的位置。
默认值:无(有一个RSA证书就够了)

email_password_file
在设置了secure_email_list_enable后,这个设置可以用来提供一个备用文件。
默认值:/etc/vsftpd.email_passwords

ftp_username
这是用来控制匿名FTP的用户名。这个用户的home目录是匿名FTP区域的根。
默认值:ftp

ftpd_banner
当一个连接首次接入时将现实一个欢迎界面。
默认值:无(默认的界面会被显示)

guest_username
参见相关设置guest_enable。这个设置设定了游客进入后,其将会被映射的名字。
默认:ftp

hide_file
设置了一个文件名或者目录名列表,这个列表内的资源会被隐藏,不管是否有隐藏属性。但如果用户知道了它的存在,
将能够对它进行完全的访问。hide_file里的资源和符合hide_file指定的规则表达式的资源将被隐藏。vsftpd的
规则表达式很简单,例如hide_file={*.mp3,.hidden,hide*,h?}
默认值:无

listen_address
如果vsftpd运行在独立模式下,本地接口的默认监听地址将被这个设置代替。
需要提供一个数字化的地址。
默认值:无

listen_address6
如果vsftpd运行在独立模式下,要为IPV6指定一个监听地址(如果listen_ipv6被启用的话)。
需要提供一个IPV6格式的地址。
默认值:无

local_root
设置一个本地(非匿名)用户登录后,vsftpd试图让他进入到的一个目录。如果失败,则略过。
默认值:无

message_file
当进入一个新目录的时候,会查找这个文件并显示文件里的内容给远程用户。dirmessage_enable需启用。
默认值:.message

nopriv_user
这是vsftpd做为完全无特权的用户的名字。这是一个专门的用户,比nobody更甚。用户nobody往往用来在一些机器上做一些重要的事情。
默认值:nobody

pam_service_name
设定vsftpd将要用到的PAM服务的名字。
默认值:ftp

pasv_address
当使用PASV命令时,vsftpd会用这个地址进行反馈。需要提供一个数字化的IP地址。
默认值:无(地址将取自进来(incoming)的连接的套接字)

rsa_cert_file
这个设置指定了SSL加密连接需要的RSA证书的位置。
默认值:/usr/share/ssl/certs/vsftpd.pem

secure_chroot_dir
这个设置指定了一个空目录,这个目录不容许ftp user写入。在vsftpd不希望文件系统被访问时,目录为安全的虚根所使用。
默认值: /usr/share/empty

ssl_ciphers
这个设置将选择vsftpd为加密的SSL连接所用的SSL密码。详细信息参见ciphers。
默认值:DES-CBC3-SHA

user_config_dir
这个强大的设置容许覆盖一些在手册页中指定的配置项(基于单个用户的)。用法很简单,最好结合范例。如果你把user_config_dir
改为/etc/vsftpd_user_conf,那么以chris登录,vsftpd将调用配置文件/etc/vsftpd_user_conf/chris。
默认值:无

user_sub_token
这个设置将依据一个模板为每个虚拟用户创建home目录。例如,如果真实用户的home目录通过guest_username为/home/virtual/$USER 指定,
并且user_sub_token设置为 $USER ,那么虚拟用户fred登录后将锁定在/home/virtual/fred下。
默认值:无

userlist_file
当userlist_enable被激活,系统将去这里调用文件。
默认值:/etc/vsftpd.user_list

vsftpd_log_file
只有xferlog_enable被设置,而xferlog_std_format没有被设置时,此项才生效。这是被生成的vsftpd格式的log文件的名字。
dual_log_enable和这个设置不能同时启用。如果你启用了syslog_enable,那么这个文件不会生成,而只产生一个系统log.
默认值:/var/log/vsftpd.log

xferlog_file
这个设置是设定生成wu-ftpd格式的log的文件名。只有启用了xferlog_enable和xferlog_std_format后才能生效。
但不能和dual_log_enable同时启用。
默认值:/var/log/xferlog

3、未完成的实验
his example should quickly show you the possibilites of per-IP configuration
with vsftpd's tcp_wrappers integration. This is new with v1.1.3.

To use this, you need vsftpd built with tcp_wrappers! This is accomplished
by editing "builddefs.h" and changing

#undef VSF_BUILD_TCPWRAPPERS
to
#define VSF_BUILD_TCPWRAPPERS

And then rebuild. If you are lucky your vendor will have shipped the vsftpd
binary with this already done for you.

Next, to enable tcp_wrappers integration, you need this in your vsftpd.conf:

tcp_wrappers=YES

And you'll need a tcp_wrappers config file. An example one is supplied in this
directory: hosts.allow. It lives at /etc/hosts.allow.

Let's have a look at the example:

vsftpd: 192.168.1.3: setenv VSFTPD_LOAD_CONF /etc/vsftpd_tcp_wrap.conf
vsftpd: 192.168.1.4: DENY

The first line:
If a client connects from 192.168.1.3, then vsftpd will apply the vsftpd
config file /etc/vsftpd_tcp_wrap.conf to the session! These settings are
applied ON TOP of the default vsftpd.conf.
This is obviously very powerful. You might use this to apply different
access restrictions for some IPs (e.g. the ability to upload).
Or you could give certain classes of IPs the ability to skip connection
limits (max_clients=0).
Or you could increase / decrease the bandwidth limiter for certain classes
of IPs.
You get the point

The second line:
Denies the ability of 192.168.1.4 to connect. Very useful to take care of
troublemakers. And now you don't need xinetd to do it - hurrah.


This example shows how you might set up virtual hosts. Virtual hosting is
where different clients access your machine on different IP addresses (virtual
IPs) and get redirected to different ftp sites.

For example, if your machine responds to two IPs - 127.0.0.1 and 127.0.0.2,
you could have the two different IPs represent two totally different FTP sites.

For this example, we are going to build on the "INTERNET_SITE" example.

Step 1) Set up a virtual IP address.

ifconfig eth0:1 192.168.1.10 up
(the standard IP address is 192.168.1.2)
(note - this isn't quite complete, the route for local connects hasn't been
added, but it will do for now)


Step 2) Create a user / location for the new virtual site.

useradd -d /var/ftp_site2 ftp_site2
chown root.root /var/ftp_site2
chmod a+rx /var/ftp_site2
umask 022
mkdir /var/ftp_site2/pub
echo "test" >; /var/ftp_site2/pub/content


Step 3) Modify the existing site to respond to the primary IP.

Edit /etc/xinetd.d/vsftpd, and add the config line:
This example shows how you might set up virtual hosts. Virtual hosting is
where different clients access your machine on different IP addresses (virtual
IPs) and get redirected to different ftp sites.

For example, if your machine responds to two IPs - 127.0.0.1 and 127.0.0.2,
you could have the two different IPs represent two totally different FTP sites.

For this example, we are going to build on the "INTERNET_SITE" example.

Step 1) Set up a virtual IP address.

ifconfig eth0:1 192.168.1.10 up
(the standard IP address is 192.168.1.2)
(note - this isn't quite complete, the route for local connects hasn't been
added, but it will do for now)


Step 2) Create a user / location for the new virtual site.

useradd -d /var/ftp_site2 ftp_site2
chown root.root /var/ftp_site2
chmod a+rx /var/ftp_site2
umask 022
mkdir /var/ftp_site2/pub
echo "test" >; /var/ftp_site2/pub/content


Step 3) Modify the existing site to respond to the primary IP.

Edit /etc/xinetd.d/vsftpd, and add the config line:

bind = 192.168.1.2


Step 4) Create the new site, responding on the virtual IP.

cp /etc/xinetd.d/vsftpd /etc/xinetd.d/vsftpd2

Edit vsftpd2, and change
- The bind line to refer to the IP address 192.168.1.10
- Add the line
server_args = /etc/vsftpd_site2.conf

This launches this FTP site with a different vsftpd configuration file.

cp /etc/vsftpd.conf /etc/vsftpd_site2.conf

Add two lines:
ftp_username=ftp_site2
ftpd_banner=This is the alternative FTP site.


Step 5) Restart xinetd and test!

/etc/rc.d/init.d/xinetd restart

[chris@localhost vsftpd]$ ftp 192.168.1.2
Connected to 192.168.1.2 (192.168.1.2).
220 ready, dude (vsFTPd 1.1.0: beat me, break me)
Name (192.168.1.2:chris): [chris@localhost vsftpd]$
[chris@localhost vsftpd]$ ftp 192.168.1.2
Connected to 192.168.1.2 (192.168.1.2).
220 ready, dude (vsFTPd 1.1.0: beat me, break me)
Name (192.168.1.2:chris):
530 This FTP server is anonymous only.
Login failed.
ftp>; quit
221 Goodbye.

[chris@localhost vsftpd]$ ftp 192.168.1.10
Connected to 192.168.1.10 (192.168.1.10).
220 This is the alternative FTP site.
Name (192.168.1.10:chris):
530 This FTP server is anonymous only.
Login failed.
ftp>;
最新评论共有 4 位网友发表了评论
发表评论
评论内容:不能超过250字,需审核,请自觉遵守互联网相关政策法规。
用户名: 密码:
匿名?
注册