VSFTPD PASSIV模式配置

         VSFTPD,什么叫主动模式,被动模式不解释了。能到这来的百度是可以上的。进入正题:关于FTP的主动和被动模式的确让人头痛,主动模式虽然只用两个端口,但用20吧,防火墙又直接把包给过滤掉了,要做映射,那没得选了(就像选老公老婆样,没得选估计就不挑了)只能用被动模式了。被动模式端口又随机的,那只能定制啰,还好VSFTPD提供了参数。有时仅仅定制PASSIVE端口还没用,这时候得加IP控制了
listen=YES --当你service vsftpd restart 报OOPS错误: vsftpd: not configured for standalone, must be started from inetd
说明/etc/rc.d/init.d/xinetd已经启动vsftpd服务了,关又关不掉,那么加这一行吧。此错误与xinetd无关.

# 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=NO 
#
# Uncomment this to allow local users to log in.
local_enable=YES
#
# Uncomment this to enable any form of FTP write command.
write_enable=YES
#
# 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
#
# 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.
#anon_upload_enable=YES
#
# Uncomment this if you want the anonymous FTP user to be able to create
# new directories.
#anon_mkdir_write_enable=YES
#
# Activate directory messages - messages given to remote users when they
# go into a certain directory.
dirmessage_enable=YES
#
# Activate logging of uploads/downloads.
xferlog_enable=YES
#
# Make sure PORT transfer connections originate from port 20 (ftp-data).
connect_from_port_20=YES
#
# 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
#chown_username=whoever
#
# You may override where the log file goes if you like. The default is shown
# below.
#xferlog_file=/var/log/vsftpd.log
#
# If you want, you can have your log file in standard ftpd xferlog format
xferlog_std_format=YES
#
# You may change the default value for timing out an idle session.
#idle_session_timeout=600
#
# You may change the default value for timing out a data connection.
#data_connection_timeout=120
#
# 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
#
# 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
#
# 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 turning on ascii_download_enable enables malicious remote parties
# to consume your I/O resources, by issuing the command "SIZE /big/file" in
# ASCII mode.
# These ASCII options are split into upload and download because you may wish
# to enable ASCII uploads (to prevent uploaded scripts etc. from breaking),
# without the DoS risk of SIZE and ASCII downloads. ASCII mangling should be
# on the client anyway..
#ascii_upload_enable=YES
#ascii_download_enable=YES
#
# You may fully customise the login banner string:
#ftpd_banner=Welcome to blah FTP service. 
#
# You may specify a file of disallowed anonymous e-mail addresses. Apparently
# useful for combatting certain DoS attacks.
#deny_email_enable=YES
# (default follows)
#banned_email_file=/etc/vsftpd.banned_emails
#
# 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().
#chroot_list_enable=YES
# (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
pasv_min_port=2003
pasv_max_port=2005
pasv_enable=YES --打开被动模式
#pasv_address=公网IP   比较有趣的是加了这个IP内网访问就会列不出目录了,所以我不是很赞成用这个,除非你只想让别人用公网访问
pasv_promiscuous=YES --用这个参数吧。PASSIVE的安全检查。

chroot_local_user=YES --锁定本地用户登陆目录
use_localtime=YES  --解决时间不一致问题

pam_service_name=vsftpd
userlist_enable=YES
#enable for standalone mode

#增加本地时间显示,不然vsftp默认GMT时区格式
use_localtime=YES



末了,详细的VSFTPD参数解释参见:http://www.chinaunix.net/jh/15/552269.html

如果在登陆时出现如下错误:

Connected to 192.168.1.19.
220 (vsFTPd 2.2.2)
User (192.168.1.19:(none)): xxx
331 Please specify the password.
Password:
500 OOPS: cannot change directory:/home/xxx
500 OOPS: priv_sock_get_cmd
Connection closed by remote host.
SELINUX捣的鬼.....

解决方法:

//setsebool使用-P参数,无需每次开机都输入这个命令
# setsebool -P ftpd_disable_trans 1
或者
# setsebool -P ftp_home_dir 1
# service vsftpd restart

posted on 2010-06-21 14:43 snowhill 阅读(967) 评论(0)  编辑 收藏 引用 所属分类: 系统管理


只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理


<2024年4月>
31123456
78910111213
14151617181920
21222324252627
2829301234
567891011

导航

公告

又一年...........

留言簿(3)

随笔分类(13)

文章分类(131)

文章档案(124)

c++

java

linux

oracle

常用软件

其他

网络配置

系统安全

音乐

搜索

最新评论

阅读排行榜