zoukankan      html  css  js  c++  java
  • Linux vsftpd服务配置具体解释

    【背景】

              近日。一朋友dominoserver要进行升级、迁移,搭建了linux測试系统,也开启vsftpd服务,但是配置的ftp账号,程序无法正常下载附件。

    【问题跟踪】

              通过ftpclient连接工具登录。发现未跳转到ftp账号指定的文件夹以下。

              cat /etc/vsftpd.config发现开启了:
              local_root=/home/test

              将此凝视重新启动ftp服务正常。


    附录(vsftpd配置具体解释):

    vsftpdserver配置文件“/etc/vsftpd/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).
    #  ####——是否同意匿名用户登录此FTPserver。默认下是“YES”同意登录。
    anonymous_enable=YES

    #
    # Uncomment this to allow local users to log in.
    #  ####——是否同意本地用户登录此FTPserver。默认下是“YES”同意登录。
    local_enable=YES
    #
    #
    # Uncomment this to enable any form of FTP write command.
    #  ####——是否同意本地登录用户具有“写入”的权限。默认下是“YES”同意。


    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)
    #  ####——设置本地用户的文件生成掩码为022。默觉得077
    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.
    #  ####——是否同意匿名登录用户具有“上传”的权限。默认下是“YES”同意。当须要启用时须要将此句前面的“#”去掉就可以。
    #anon_upload_enable=YES
    #
    #
    # Uncomment this if you want the anonymous FTP user to be able to create
    # new directories.
    #  ####——是否同意匿名登录用户具有“创建文件夹”的权限。

    默认下是“YES”同意。当须要启用时须要将此句前面的“#”去掉就可以。


    #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).
    #  ####——启用FTPserver数据port的连接请求。


    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.
    #  ####——设置日志文件的文件名称及存储路径。默认是/var/log/vsftpd.log。启用时须要将此句前面的“#”去掉。
    #xferlog_file=/var/log/vsftpd.log
    #
    #
    # If you want, you can have your log file in standard ftpd xferlog format
    #  ####——是否使用标准的ftpd xferlog日志文件格式。默认是启用的。
    xferlog_std_format=YES
    #
    #
    # You may change the default value for timing out an idle session.
    #  ####——设置空暇的用户会话中断时间,默认是10分钟。启用时须要将此句前面的“#”去掉。
    #idle_session_timeout=600
    #
    #
    # You may change the default value for timing out a data connection.
    #  ####——设置连接超时的时间。默认是120秒。

    启用时须要将此句前面的“#”去掉。
    #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格式上传和下载文件。默认下是“YES”同意。当须要启用时须要将此句前面的“#”去掉就可以。
    #ascii_upload_enable=YES
    #ascii_download_enable=YES
    #
    #
    # You may fully customise the login banner string:
    #  ####——设置FTP用户登录server时显示的欢迎信息。

    当须要启用时须要将此句前面的“#”去掉就可以。
    #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().
    #  ####——假设希望用户登录后不能切换到自己文件夹以外的其它文件夹,须要去掉此句前面的“#”,启用此句。假设启用此项功能,那么仅仅同意/etc/vsftpd.chroot_list中列出的用户具有该功能。假设希望全部的本地用户都具有此功能。能够在后面添加一行代码:chroot_local_user=YES。
    #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
    #

    #  ####——设置PAM认证服务的配置文件名,该文件存放在/etc/pam.d/文件夹下。


    pam_service_name=vsftpd
    #  ####——用户列表中的用户是否同意登录到FTPserver。默认是不同意。


    userlist_enable=YES
    #enable for standalone mode
    #  ####——使vsftpd处于独立启动模式。


    listen=YES
    #  ####——使用tcp_wrappers作为主机訪问控制方式。


    tcp_wrappers=YES   
    ####——额外配置
    #
    #
    #  ####——设置连接server的最大并发连接数和用户的最大线程
    #max_clients=100      //设置同一时候连接FTPserver的并发用户为100
    #max_per_ip=2         //设置每用户同一时段并发下载线程数为2,同一时候仅仅可下面载两个文件
    #
    #
    #  ####——设置匿名用户和本地用户的最大传输速率
    #anon_max_rate=20000     //设置匿名用户的最大传输速率为20Kbps
    #local_max_rate=1000000  //设置本地用户的最大传输速率为1Mbps
    #
    #
    #  ####——禁止某些IP段的匿名用户訪问FTPserver
    #首先确认配置文件/etc/vsftpd/vsftpd.conf中有例如以下语句且是启用的:
    #tcp_wrappers=YES
    #用gedit改动文件/etc/hosts.allow例如以下所看到的:
    #hosts.allow This file describes the names of the hosts which are
    #      allowed to use the local INET services,as decided
    #      by the '/usr/sbin/tcpd' server.
    vsftpd:192.168.1.9:DENY       //限制IP地址为192.168.1.9和192.168.1.12的主机訪问FTPserver,
    vsftpd:192.168.1.12:DENY        切记,一定要在IP地址前面加上“vsftpd:”。


    #
    #
    # ####——同意用户列表中的用户訪问FTPserver。其它不在列表中的用户禁止訪问
    #userlist_enable=yes
    #userlist_deny=NO
    #userlist_file=/etc/vsftpd/user_list
    #
    #
    # ####——更改FTPserver默认的port号和IP地址,在配置文件/etc/vsftpd/vsftpd.conf中加入例如以下语句(去除凝视符号):
    #listen_port=5555       //指定serverport号为“5555”,注意:port号要尽量大于4000
    #listen_address=192.168.0.3  //指定server监听的IP地址为192.168.0.3

    # ####——基本操作命令
    1、查询vsftpd是否安装命令   rpm -qa | grep vsftpd
    2、关闭、启动、重新启动、状态命令
      /etc/rc.d/init.d/vsftpd stop|start|restart|status  
    service vsftpd stop|start|restart|status # #  
    server性能优化命令集:
    One_process_model=YES  ——每一个IP单一进程模式
    Idle_session_timeout=120  ——踢出空暇2分钟后的用户
    Data_connection_timeout=300  ——踢出空暇5分钟后的下载
    Accept_timeout=60   ——踢出挂起1分钟后的被动连接
    Connect_timeout=60   ——踢出挂起1分钟后的活动连接
    Anon_max_rate=50000   ——匿名用户最大传输速率为50kb/s 
    匿名账户配置命令集:
    anonymous_enable=YES           ——同意匿名账户登录
    anon_mkdir_write_enable=YES      ——开启匿名账户创建文件夹和写入文件权限
    anon_upload_enable=YES          ——开启匿名账户上传权限
    anon_world_readable_only=NO      ——匿名账户不仅仅仅有下载权限
    anon_umask=022                 ——新增文件的权限
    anon_other_write_enable=NO       ——关闭匿名账户删除、改名权限
    anon_max_rate=50000             ——限制最大传输速率
    anon_root=/var/ftp/                ——设定匿名账户登录的根文件夹
    no_anon_password=YES           ——匿名用户不用输入密码
    ftp_username=test                 ——指定匿名账户的相应本地账户
    chown_uploads=YES              ——匿名上传文件的属主为以下指定账户
    chown_username=test              ——匿名上传文件的属主的账户 
    本地账户配置命令集
    local_enable=YES                     ——同意本地账户登录
    write_enable=YES                     ——开启本地账户的写权限
    local_umask=022                      ——新增文件的权限
    chroot_local_enable=YES               ——本地账户不能切换到家文件夹之外
    chroot_list_enable=YES                 ——同意某些本地账户能够切换到外面
    chroot_list_file=/etc/vsftpd/chroot_list      ——同意切换到外面的本地账户列表
    local_root=/home/test                   ——设定本地账户登录的根文件夹
    chmod_enable=YES                    ——本地账户可改动文件权限(SITE CHMOD)
    local_max_rate=1000000                ——本地账户的最大传输速率 
    虚拟用户配置命令集
    guest_enable=yes   ——启用虚拟用户
    guest_username=ftp   ——指定虚拟用户映射的本地用户,默觉得ftp,能够更改

    
  • 相关阅读:
    内存泄漏 Memory Leaks 内存优化 MD
    Handler Thread 内部类引起内存泄露分析
    为什么不取消注册BroadcastReceiver会导致内存泄漏
    WebChromeClient 简介 API 案例
    WebViewClient 简介 API 案例
    java.net.URI 简介 文档 API
    android.net.Uri 简介 API
    RV 多样式 MultiType 聊天界面 消息类型 MD
    JS函数声明与定义,作用域,函数声明与表达式的区别
    CSS中table tr:nth-child(even)改变tr背景颜色: IE7,8无效
  • 原文地址:https://www.cnblogs.com/bhlsheji/p/5238507.html
Copyright © 2011-2022 走看看