1. iptables
# Generated by iptables-save v1.4.7 on Fri Jan 6 16:53:09 2017 #*filter #:INPUT ACCEPT [174:12442] #:FORWARD ACCEPT [0:0] #:OUTPUT ACCEPT [96:10704] #-A INPUT -p tcp -m tcp --dport 3306 -j ACCEPT #-A INPUT -p tcp -m state --state NEW -m tcp --dport 21 -j ACCEPT #-A INPUT -p tcp -m tcp --dport 8080 -j ACCEPT #COMMIT # Completed on Fri Jan 6 16:53:09 2017 #------------------------------------ # Firewall configuration written by system-config-firewall # Manual customization of this file is not recommended. *filter :INPUT ACCEPT [0:0] :FORWARD ACCEPT [0:0] :OUTPUT ACCEPT [0:0] -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT -A INPUT -p icmp -j ACCEPT -A INPUT -i lo -j ACCEPT #ssh port -A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT #vsftpd -A INPUT -p TCP --dport 61001:62000 -j ACCEPT -A OUTPUT -p TCP --sport 61001:62000 -j ACCEPT -A INPUT -p TCP --dport 20 -j ACCEPT -A OUTPUT -p TCP --sport 20 -j ACCEPT -A INPUT -p TCP --dport 21 -j ACCEPT -A OUTPUT -p TCP --sport 21 -j ACCEPT #mysql port -A INPUT -p tcp -m tcp --dport 3306 -j ACCEPT #tomcat remote debug port -A INPUT -p tcp -m tcp --dport 5005 -j ACCEPT -A INPUT -p tcp -m tcp --dport 8080 -j ACCEPT #nginx -A INPUT -p tcp -m tcp --dport 80 -j ACCEPT -A INPUT -j REJECT --reject-with icmp-host-prohibited -A FORWARD -j REJECT --reject-with icmp-host-prohibited COMMIT
2. profile
# /etc/profile # System wide environment and startup programs, for login setup # Functions and aliases go in /etc/bashrc # It's NOT a good idea to change this file unless you know what you # are doing. It's much better to create a custom.sh shell script in # /etc/profile.d/ to make custom changes to your environment, as this # will prevent the need for merging in future updates. pathmunge () { case ":${PATH}:" in *:"$1":*) ;; *) if [ "$2" = "after" ] ; then PATH=$PATH:$1 else PATH=$1:$PATH fi esac } if [ -x /usr/bin/id ]; then if [ -z "$EUID" ]; then # ksh workaround EUID=`id -u` UID=`id -ru` fi USER="`id -un`" LOGNAME=$USER MAIL="/var/spool/mail/$USER" fi # Path manipulation if [ "$EUID" = "0" ]; then pathmunge /sbin pathmunge /usr/sbin pathmunge /usr/local/sbin else pathmunge /usr/local/sbin after pathmunge /usr/sbin after pathmunge /sbin after fi HOSTNAME=`/bin/hostname 2>/dev/null` HISTSIZE=1000 if [ "$HISTCONTROL" = "ignorespace" ] ; then export HISTCONTROL=ignoreboth else export HISTCONTROL=ignoredups fi export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE HISTCONTROL # By default, we want umask to get set. This sets it for login shell # Current threshold for system reserved uid/gids is 200 # You could check uidgid reservation validity in # /usr/share/doc/setup-*/uidgid file if [ $UID -gt 199 ] && [ "`id -gn`" = "`id -un`" ]; then umask 002 else umask 022 fi for i in /etc/profile.d/*.sh ; do if [ -r "$i" ]; then if [ "${-#*i}" != "$-" ]; then . "$i" else . "$i" >/dev/null 2>&1 fi fi done unset i unset -f pathmunge export JAVA_HOME=/usr/java/jdk1.7.0_80 export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar export MAVEN_HOME=/developer/apache-maven-3.0.5 export NODE_HOME=/usr/local/node-v4.4.7-linux-x64 export RUBY_HOME=/usr/local/ruby export CATALINA_HOME=/developer/apache-tomcat-7.0.73 export PATH=$PATH:$JAVA_HOME/bin:$CATALINA_HOME/bin:$MAVEN_HOME/bin:$NODE_HOME/bin:/usr/local/bin:$RUBY_HOME/bin export LC_ALL=en_US.UTF-8
3. Centos repo
# CentOS-Base.repo # # The mirror system uses the connecting IP address of the client and the # update status of each mirror to pick mirrors that are updated to and # geographically close to the client. You should use this for CentOS updates # unless you are manually picking other mirrors. # # If the mirrorlist= does not work for you, as a fall back you can try the # remarked out baseurl= line instead. # # [base] name=CentOS-$releasever - Base - mirrors.aliyun.com failovermethod=priority baseurl=http://mirrors.aliyun.com/centos/$releasever/os/$basearch/ http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/ #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os gpgcheck=1 gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-6 #released updates [updates] name=CentOS-$releasever - Updates - mirrors.aliyun.com failovermethod=priority baseurl=http://mirrors.aliyun.com/centos/$releasever/updates/$basearch/ http://mirrors.aliyuncs.com/centos/$releasever/updates/$basearch/ #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates gpgcheck=1 gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-6 #additional packages that may be useful [extras] name=CentOS-$releasever - Extras - mirrors.aliyun.com failovermethod=priority baseurl=http://mirrors.aliyun.com/centos/$releasever/extras/$basearch/ http://mirrors.aliyuncs.com/centos/$releasever/extras/$basearch/ #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras gpgcheck=1 gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-6 #additional packages that extend functionality of existing packages [centosplus] name=CentOS-$releasever - Plus - mirrors.aliyun.com failovermethod=priority baseurl=http://mirrors.aliyun.com/centos/$releasever/centosplus/$basearch/ http://mirrors.aliyuncs.com/centos/$releasever/centosplus/$basearch/ #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus gpgcheck=1 enabled=0 gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-6 #contrib - packages by Centos Users [contrib] name=CentOS-$releasever - Contrib - mirrors.aliyun.com failovermethod=priority baseurl=http://mirrors.aliyun.com/centos/$releasever/contrib/$basearch/ http://mirrors.aliyuncs.com/centos/$releasever/contrib/$basearch/ #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib gpgcheck=1 enabled=0 gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-6
4. vsftpdconfig
(1) chroot_list
ftpserver
(2) 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). local_root=/product/ftpfile #chroot_local_user=YES anon_root=/product/ftpfile use_localtime=YES #匿名 #anonymous_enable=YES 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 # # The target log file can be vsftpd_log_file or xferlog_file. # This depends on setting xferlog_std_format parameter 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 # # The name of log file when xferlog_enable=YES and xferlog_std_format=YES # WARNING - changing this filename affects /etc/logrotate.d/vsftpd.log #xferlog_file=/var/log/xferlog # # Switches between logging into vsftpd_log_file and xferlog_file files. # NO writes to vsftpd_log_file, YES to xferlog_file 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 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_download_enable=YES # # You may fully customise the login banner string: ftpd_banner=Welcome to mmall FTP Server # # 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_local_user=NO 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 # # 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=YES # # This directive enables listening on IPv6 sockets. To listen on IPv4 and IPv6 # sockets, you must run two copies of vsftpd with two configuration files. # Make sure, that one of the listen options is commented !! #listen_ipv6=YES pam_service_name=vsftpd userlist_enable=YES tcp_wrappers=YES #pasv_enable=YES pasv_min_port=61001 pasv_max_port=62000
(3) vsftpd.conf.readme
1)local_root=/ftpfile(当本地用户登入时,将被更换到定义的目录下,默认值为各用户的家目录) 2)anon_root=/ftpfile(使用匿名登入时,所登入的目录) 3)use_localtime=YES(默认是GMT时间,改成使用本机系统时间) 4)anonymous_enable=NO(不允许匿名用户登录) 5)local_enable=YES(允许本地用户登录) 6)write_enable=YES(本地用户可以在自己家目录中进行读写操作) 7)local_umask=022(本地用户新增档案时的umask值) 8)dirmessage_enable=YES(如果启动这个选项,那么使用者第一次进入一个目录时,会检查该目录下是否有.message这个档案,如果有,则会出现此档案的内容,通常这个档案会放置欢迎话语,或是对该目录的说明。默认值为开启) 9)xferlog_enable=YES(是否启用上传/下载日志记录。如果启用,则上传与下载的信息将被完整纪录在xferlog_file 所定义的档案中。预设为开启。) 10)connect_from_port_20=YES(指定FTP使用20端口进行数据传输,默认值为YES) 11)xferlog_std_format=YES(如果启用,则日志文件将会写成xferlog的标准格式) 12)ftpd_banner=Welcome to mmall FTP Server(这里用来定义欢迎话语的字符串) 13)chroot_local_user=NO(用于指定用户列表文件中的用户是否允许切换到上级目录) 14)chroot_list_enable=YES(设置是否启用chroot_list_file配置项指定的用户列表文件) 15)chroot_list_file=/etc/vsftpd/chroot_list(用于指定用户列表文件) 16)listen=YES(设置vsftpd服务器是否以standalone模式运行,以standalone模式运行是一种较好的方式,此时listen必须设置为YES,此为默认值。建议不要更改,有很多与服务器运行相关的配置命令,需要在此模式下才有效,若设置为NO,则vsftpd不是以独立的服务运行,要受到xinetd服务的管控,功能上会受到限制) 17)pam_service_name=vsftpd(虚拟用户使用PAM认证方式,这里是设置PAM使用的名称,默认即可,与/etc/pam.d/vsftpd对应) userlist_enable=YES(是否启用vsftpd.user_list文件,黑名单,白名单都可以 18)pasv_min_port=61001(被动模式使用端口范围最小值) 19)pasv_max_port=62000(被动模式使用端口范围最大值) 20)pasv_enable=YES(pasv_enable=YES/NO(YES) 若设置为YES,则使用PASV工作模式;若设置为NO,则使用PORT模式。默认值为YES,即使用PASV工作模式。 FTP协议有两种工作方式:PORT方式和PASV方式,中文意思为主动式和被动式。 一、PORT(主动)方式的连接过程是:客户端向服务器的FTP端口(默认是21)发送连接请求,服务器接受连接,建立一条命令链路。 当需要传送数据时,客户端在命令链路上用 PORT命令告诉服务器:“我打开了****端口,你过来连接我”。于是服务器从20端口向客户端的****端口发送连接请求,建立一条数据链路来传送数据。 二、PASV(被动)方式的连接过程是:客户端向服务器的FTP端口(默认是21)发送连接请求,服务器接受连接,建立一条命令链路。 当需要传送数据时,服务器在命令链路上用 PASV命令告诉客户端:“我打开了****端口,你过来连接我”。于是客户端向服务器的****端口发送连接请求,建立一条数据链路来传送数据。 从上面可以看出,两种方式的命令链路连接方法是一样的,而数据链路的建立方法就完全不同。而FTP的复杂性就在于此。 ) 本项目要用到的配置项:
(4) vsftp详细配置
vsftpd配置文件详解 1.默认配置: 1>允许匿名用户和本地用户登陆。 anonymous_enable=YES local_enable=YES 2>匿名用户使用的登陆名为ftp或anonymous,口令为空;匿名用户不能离开匿名用户家目录/var/ftp,且只能下载不能上传。 3>本地用户的登录名为本地用户名,口令为此本地用户的口令;本地用户可以在自 己家目录中进行读写操作;本地用户可以离开自家目录切换至有权限访问的其他目录,并在权限允许的情况下进行上传/下载。 write_enable=YES 4>写在文件/etc/vsftpd.ftpusers中的本地用户禁止登陆。 2.配置文件格式: vsftpd.conf 的内容非常单纯,每一行即为一项设定。若是空白行或是开头为#的一行,将会被忽略。内容的格式只有一种,如下所示: option=value 要注意的是,等号两边不能加空白。 3.匿名用户(anonymous)设置 anonymous_enable=YES/NO(YES) 控制是否允许匿名用户登入,YES 为允许匿名登入,NO 为不允许。默认值为YES。 write_enable=YES/NO(YES) 是否允许登陆用户有写权限。属于全局设置,默认值为YES。 no_anon_password=YES/NO(NO) 若是启动这项功能,则使用匿名登入时,不会询问密码。默认值为NO。 ftp_username=ftp 定义匿名登入的使用者名称。默认值为ftp。 anon_root=/var/ftp 使用匿名登入时,所登入的目录。默认值为/var/ftp。注意ftp目录不能是777的权限属性,即匿名用户的家目录不能有777的权限。 anon_upload_enable=YES/NO(NO) 如果设为YES,则允许匿名登入者有上传文件(非目录)的权限,只有在write_enable=YES时,此项才有效。当然,匿名用户必须要有对上层目录的写入权。默认值为NO。 anon_world_readable_only=YES/NO(YES) 如果设为YES,则允许匿名登入者下载可阅读的档案(可以下载到本机阅读,不能直接在FTP服务器中打开阅读)。默认值为YES。 anon_mkdir_write_enable=YES/NO(NO) 如果设为YES,则允许匿名登入者有新增目录的权限,只有在write_enable=YES时,此项才有效。当然,匿名用户必须要有对上层目录的写入权。默认值为NO。 anon_other_write_enable=YES/NO(NO) 如果设为YES,则允许匿名登入者更多于上传或者建立目录之外的权限,譬如删除或者重命名。(如果anon_upload_enable=NO,则匿名用户不能上传文件,但可以删除或者重命名已经存在的文件;如果anon_mkdir_write_enable=NO,则匿名用户不能上传或者新建文件夹,但可以删除或者重命名已经存在的文件夹。)默认值为NO。 chown_uploads=YES/NO(NO) 设置是否改变匿名用户上传文件(非目录)的属主。默认值为NO。 chown_username=username 设置匿名用户上传文件(非目录)的属主名。建议不要设置为root。 anon_umask=077 设置匿名登入者新增或上传档案时的umask 值。默认值为077,则新建档案的对应权限为700。 deny_email_enable=YES/NO(NO) 若是启动这项功能,则必须提供一个档案/etc/vsftpd/banner_emails,内容为email address。若是使用匿名登入,则会要求输入email address,若输入的email address 在此档案内,则不允许进入。默认值为NO。 banned_email_file=/etc/vsftpd/banner_emails 此文件用来输入email address,只有在deny_email_enable=YES时,才会使用到此档案。若是使用匿名登入,则会要求输入email address,若输入的email address 在此档案内,则不允许进入。 4.本地用户设置 local_enable=YES/NO(YES) 控制是否允许本地用户登入,YES 为允许本地用户登入,NO为不允许。默认值为YES。 local_root=/home/username 当本地用户登入时,将被更换到定义的目录下。默认值为各用户的家目录。 write_enable=YES/NO(YES) 是否允许登陆用户有写权限。属于全局设置,默认值为YES。 local_umask=022 本地用户新增档案时的umask 值。默认值为077。 file_open_mode=0755 本地用户上传档案后的档案权限,与chmod 所使用的数值相同。默认值为0666。 5.欢迎语设置 dirmessage_enable=YES/NO(YES) 如果启动这个选项,那么使用者第一次进入一个目录时,会检查该目录下是否有.message这个档案,如果有,则会出现此档案的内容,通常这个档案会放置欢迎话语,或是对该目录的说明。默认值为开启。 message_file=.message 设置目录消息文件,可将要显示的信息写入该文件。默认值为.message。 banner_file=/etc/vsftpd/banner 当使用者登入时,会显示此设定所在的档案内容,通常为欢迎话语或是说明。默认值为无。如果欢迎信息较多,则使用该配置项。 ftpd_banner=Welcome to BOB's FTP server 这里用来定义欢迎话语的字符串,banner_file是档案的形式,而ftpd_banner 则是字符串的形式。预设为无。 6.控制用户是否允许切换到上级目录 在默认配置下,本地用户登入FTP后可以使用cd命令切换到其他目录,这样会对系统带来安全隐患。可以通过以下三条配置文件来控制用户切换目录。 chroot_list_enable=YES/NO(NO) 设置是否启用chroot_list_file配置项指定的用户列表文件。默认值为NO。 chroot_list_file=/etc/vsftpd.chroot_list 用于指定用户列表文件,该文件用于控制哪些用户可以切换到用户家目录的上级目录。 chroot_local_user=YES/NO(NO) 用于指定用户列表文件中的用户是否允许切换到上级目录。默认值为NO。 通过搭配能实现以下几种效果: ①当chroot_list_enable=YES,chroot_local_user=YES时,在/etc/vsftpd.chroot_list文件中列出的用户,可以切换到其他目录;未在文件中列出的用户,不能切换到其他目录。 ②当chroot_list_enable=YES,chroot_local_user=NO时,在/etc/vsftpd.chroot_list文件中列出的用户,不能切换到其他目录;未在文件中列出的用户,可以切换到其他目录。 ③当chroot_list_enable=NO,chroot_local_user=YES时,所有的用户均不能切换到其他目录。 ④当chroot_list_enable=NO,chroot_local_user=NO时,所有的用户均可以切换到其他目录。 7.数据传输模式设置 FTP在传输数据时,可以使用二进制方式,也可以使用ASCII模式来上传或下载数据。 ascii_upload_enable=YES/NO(NO) 设置是否启用ASCII 模式上传数据。默认值为NO。 ascii_download_enable=YES/NO(NO) 设置是否启用ASCII 模式下载数据。默认值为NO。 8.访问控制设置 两种控制方式:一种控制主机访问,另一种控制用户访问。 ①控制主机访问: tcp_wrappers=YES/NO(YES) 设置vsftpd是否与tcp wrapper相结合来进行主机的访问控制。默认值为YES。如果启用,则vsftpd服务器会检查/etc/hosts.allow 和/etc/hosts.deny 中的设置,来决定请求连接的主机,是否允许访问该FTP服务器。这两个文件可以起到简易的防火墙功能。 比如:若要仅允许192.168.0.1—192.168.0.254的用户可以连接FTP服务器,则在/etc/hosts.allow文件中添加以下内容: vsftpd:192.168.0. :allow all:all :deny ②控制用户访问: 对于用户的访问控制可以通过/etc目录下的vsftpd.user_list和ftpusers文件来实现。 userlist_file=/etc/vsftpd.user_list 控制用户访问FTP的文件,里面写着用户名称。一个用户名称一行。 userlist_enable=YES/NO(NO) 是否启用vsftpd.user_list文件。 userlist_deny=YES/NO(YES) 决定vsftpd.user_list文件中的用户是否能够访问FTP服务器。若设置为YES,则vsftpd.user_list文件中的用户不允许访问FTP,若设置为NO,则只有vsftpd.user_list文件中的用户才能访问FTP。 /etc/vsftpd/ftpusers文件专门用于定义不允许访问FTP服务器的用户列表(注意:如果userlist_enable=YES,userlist_deny=NO,此时如果在vsftpd.user_list和ftpusers中都有某个用户时,那么这个用户是不能够访问FTP的,即ftpusers的优先级要高)。默认情况下vsftpd.user_list和ftpusers,这两个文件已经预设置了一些不允许访问FTP服务器的系统内部账户。如果系统没有这两个文件,那么新建这两个文件,将用户添加进去即可。 9.访问速率设置 anon_max_rate=0 设置匿名登入者使用的最大传输速度,单位为B/s,0 表示不限制速度。默认值为0。 local_max_rate=0 本地用户使用的最大传输速度,单位为B/s,0 表示不限制速度。预设值为0。 10.超时时间设置 accept_timeout=60 设置建立FTP连接的超时时间,单位为秒。默认值为60。 connect_timeout=60 PORT 方式下建立数据连接的超时时间,单位为秒。默认值为60。 data_connection_timeout=120 设置建立FTP数据连接的超时时间,单位为秒。默认值为120。 idle_session_timeout=300 设置多长时间不对FTP服务器进行任何操作,则断开该FTP连接,单位为秒。默认值为300。 11.日志文件设置 xferlog_enable= YES/NO(YES) 是否启用上传/下载日志记录。如果启用,则上传与下载的信息将被完整纪录在xferlog_file 所定义的档案中。预设为开启。 xferlog_file=/var/log/vsftpd.log 设置日志文件名和路径,默认值为/var/log/vsftpd.log。 xferlog_std_format=YES/NO(NO) 如果启用,则日志文件将会写成xferlog的标准格式,如同wu-ftpd 一般。默认值为关闭。 log_ftp_protocol=YES|NO(NO) 如果启用此选项,所有的FTP请求和响应都会被记录到日志中,默认日志文件在/var/log/vsftpd.log。启用此选项时,xferlog_std_format不能被激活。这个选项有助于调试。默认值为NO。 12.定义用户配置文件 在vsftpd中,可以通过定义用户配置文件来实现不同的用户使用不同的配置。 user_config_dir=/etc/vsftpd/userconf 设置用户配置文件所在的目录。当设置了该配置项后,用户登陆服务器后,系统就会到/etc/vsftpd/userconf目录下,读取与当前用户名相同的文件,并根据文件中的配置命令,对当前用户进行更进一步的配置。 例如:定义user_config_dir=/etc/vsftpd/userconf,且主机上有使用者 test1,test2,那么我们就在user_config_dir 的目录新增文件名为test1和test2两个文件。若是test1 登入,则会读取user_config_dir 下的test1 这个档案内的设定。默认值为无。利用用户配置文件,可以实现对不同用户进行访问速度的控制,在各用户配置文件中定义local_max_rate=XX,即可。 13.FTP的工作方式与端口设置 FTP有两种工作方式:PORT FTP(主动模式)和PASV FTP(被动模式) listen_port=21 设置FTP服务器建立连接所监听的端口,默认值为21。 connect_from_port_20=YES/NO 指定FTP使用20端口进行数据传输,默认值为YES。 ftp_data_port=20 设置在PORT方式下,FTP数据连接使用的端口,默认值为20。 pasv_enable=YES/NO(YES) 若设置为YES,则使用PASV工作模式;若设置为NO,则使用PORT模式。默认值为YES,即使用PASV工作模式。 pasv_max_port=0 在PASV工作模式下,数据连接可以使用的端口范围的最大端口,0 表示任意端口。默认值为0。 pasv_min_port=0 在PASV工作模式下,数据连接可以使用的端口范围的最小端口,0 表示任意端口。默认值为0。 14.与连接相关的设置 listen=YES/NO(YES) 设置vsftpd服务器是否以standalone模式运行。以standalone模式运行是一种较好的方式,此时listen必须设置为YES,此为默认值。建议不要更改,有很多与服务器运行相关的配置命令,需要在此模式下才有效。若设置为NO,则vsftpd不是以独立的服务运行,要受到xinetd服务的管控,功能上会受到限制。 max_clients=0 设置vsftpd允许的最大连接数,默认值为0,表示不受限制。若设置为100时,则同时允许有100个连接,超出的将被拒绝。只有在standalone模式运行才有效。 max_per_ip=0 设置每个IP允许与FTP服务器同时建立连接的数目。默认值为0,表示不受限制。只有在standalone模式运行才有效。 listen_address=IP地址 设置FTP服务器在指定的IP地址上侦听用户的FTP请求。若不设置,则对服务器绑定的所有IP地址进行侦听。只有在standalone模式运行才有效。 setproctitle_enable=YES/NO(NO) 设置每个与FTP服务器的连接,是否以不同的进程表现出来。默认值为NO,此时使用ps aux |grep ftp只会有一个vsftpd的进程。若设置为YES,则每个连接都会有一个vsftpd的进程。 15.虚拟用户设置 虚拟用户使用PAM认证方式。 pam_service_name=vsftpd 设置PAM使用的名称,默认值为/etc/pam.d/vsftpd。 guest_enable= YES/NO(NO) 启用虚拟用户。默认值为NO。 guest_username=ftp 这里用来映射虚拟用户。默认值为ftp。 virtual_use_local_privs=YES/NO(NO) 当该参数激活(YES)时,虚拟用户使用与本地用户相同的权限。当此参数关闭(NO)时,虚拟用户使用与匿名用户相同的权限。默认情况下此参数是关闭的(NO)。 16.其他设置 text_userdb_names= YES/NO(NO) 设置在执行ls –la之类的命令时,是显示UID、GID还是显示出具体的用户名和组名。默认值为NO,即以UID和GID方式显示。若希望显示用户名和组名,则设置为YES。 ls_recurse_enable=YES/NO(NO) 若是启用此功能,则允许登入者使用ls –R(可以查看当前目录下子目录中的文件)这个指令。默认值为NO。 hide_ids=YES/NO(NO) 如果启用此功能,所有档案的拥有者与群组都为ftp,也就是使用者登入使用ls -al之类的指令,所看到的档案拥有者跟群组均为ftp。默认值为关闭。 download_enable=YES/NO(YES) 如果设置为NO,所有的文件都不能下载到本地,文件夹不受影响。默认值为YES。