温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

ftp的常用配置文件参数

发布时间:2021-09-14 18:04:23 来源:亿速云 阅读:208 作者:chen 栏目:建站服务器

这篇文章主要介绍“ftp的常用配置文件参数”,在日常操作中,相信很多人在ftp的常用配置文件参数问题上存在疑惑,小编查阅了各式资料,整理出简单好用的操作方法,希望对大家解答”ftp的常用配置文件参数”的疑惑有所帮助!接下来,请跟着小编一起来学习吧!

ftp用户:

    系统用户

    匿名用户---->系统用户 

    虚拟用户---->系统用户

ftp用户的默认访问目录:

    匿名用户访问目录:/var/ftp

    系统用户的访问目录:用户的家目录

安全通信方式

    ftps: ftp+ssl/tls

    sftp: OpenSSH,SubSystem,sftp(SSH)

1 安装软件

[root@CnBJYwz01QNmoSmokepingL01 ~]# yum -y install vsftpd

Loaded plugins: fastestmirror

Loading mirror speeds from cached hostfile

 * base: mirrors.btte.net

 * epel: mirrors.aliyun.com

 * extras: mirrors.btte.net

 * updates: mirrors.btte.net

Setting up Install Process

Resolving Dependencies

--> Running transaction check

---> Package vsftpd.x86_64 0:2.2.2-21.el6 will be installed

--> Finished Dependency Resolution


Dependencies Resolved


==============================================================================================================================================================================

 Package                                 Arch                                    Version                                          Repository                             Size

==============================================================================================================================================================================

Installing:

 vsftpd                                  x86_64                                  2.2.2-21.el6                                     base                                  155 k


Transaction Summary

==============================================================================================================================================================================

Install       1 Package(s)


Total download size: 155 k

Installed size: 340 k

Downloading Packages:

vsftpd-2.2.2-21.el6.x86_64.rpm                                                                                                                         | 155 kB     00:00     

Running rpm_check_debug

Running Transaction Test

Transaction Test Succeeded

Running Transaction

  Installing : vsftpd-2.2.2-21.el6.x86_64                                                                                                                                 1/1 

  Verifying  : vsftpd-2.2.2-21.el6.x86_64                                                                                                                                 1/1 


Installed:

  vsftpd.x86_64 0:2.2.2-21.el6                                                                                                                                                


Complete!


[root@CnBJYwz01QNmoSmokepingL01 ~]# rpm -ql vsftpd

/etc/logrotate.d/vsftpd

/etc/pam.d/vsftpd

/etc/rc.d/init.d/vsftpd

/etc/vsftpd

/etc/vsftpd/ftpusers

/etc/vsftpd/user_list

/etc/vsftpd/vsftpd.conf

/etc/vsftpd/vsftpd_conf_migrate.sh

/usr/sbin/vsftpd

/usr/share/doc/vsftpd-2.2.2

.......

/var/ftp             //ftp服务的根目录

/var/ftp/pub

2 启动服务

[root@CnBJYwz01QNmoSmokepingL01 ~]# /etc/init.d/vsftpd start

Starting vsftpd for vsftpd:                                [  OK  ]

[root@CnBJYwz01QNmoSmokepingL01 ~]# chkconfig vsftpd on

[root@CnBJYwz01QNmoSmokepingL01 ~]#

3 测试登陆

匿名登陆ftp服务器

localhost:~ ray$ ftp 192.168.2.141

Connected to 192.168.2.141.

220 (vsFTPd 2.2.2)

Name (192.168.2.141:ray): anonymous

331 Please specify the password.

Password: 

230 Login successful.

Remote system type is UNIX.

Using binary mode to transfer files.

ftp> 

ftp> help

Commands may be abbreviated.  Commands are:


!        features    mls        prompt        site

$        fget        mlsd        proxy        size

account        form        mlst        put        sndbuf

append        ftp        mode        pwd        status

ascii        gate        modtime        quit        struct

bell        get        more        quote        sunique

binary        glob        mput        rate        system

bye        hash        mreget        rcvbuf        tenex

case        help        msend        recv        throttle

cd        idle        newer        reget        trace

cdup        image        nlist        remopts        type

chmod        lcd        nmap        rename        umask

close        less        ntrans        reset        unset

cr        lpage        open        restart        usage

debug        lpwd        page        rhelp        user

delete        ls        passive        rmdir        verbose

dir        macdef        pdir        rstatus        xferbuf

disconnect    mdelete        pls        runique        ?

edit        mdir        pmlsd        send

epsv4        mget        preserve    sendport

exit        mkdir        progress    set

ftp> 


系统用户登陆

[localhost:~ ray$ ftp 192.168.2.142

Connected to 192.168.2.142.

220 (vsFTPd 2.2.2)

Name (192.168.2.142:ray): ray

331 Please specify the password.

Password: 

230 Login successful.

Remote system type is UNIX.

Using binary mode to transfer files.

ftp> 

ftp> 

ftp> ls

229 Entering Extended Passive Mode (|||59706|).

150 Here comes the directory listing.

226 Directory send OK.

ftp> 

ftp> pwd

Remote directory: /home/ray

ftp>

4 常用配置文件参数

# Allow anonymous FTP? (Beware - allowed by default if you comment this out).

anonymous_enable=YES  #是否允许匿名用户登陆


# 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      #是否允许上传文件


anon_upload_enable=YES  #是否允许匿名用户上传文件,打开上传权限。注意:最终文件能否上传成功,取决于文件系统权限和文件共享权限


anon_mkdir_write_enable=YES  #是否允许匿名用户创建目录

anon_other_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            #是否打开传输日志,记录上传下载的操作命令


# 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       #指定传输日志的路径


# 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 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          #超时时间,数据连接



# 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=YES                #是否将所有用户限制在主目录,YES为启用 NO禁用.(该项默认值是NO,即在安装vsftpd后不做配置的话,ftp用户是可以向上切换到要目录之外的)

#chroot_list_enable=YES               #是否允许启用限制用户名单

# (default follows)

#chroot_list_file=/etc/vsftpd/chroot_list      #禁锢用户列表,文件需要主动创建



# 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                            #是否为独立守护进程



userlist_enable=YES                   #是否启用/etc/vsftpd/user_list名单

userlist_deny=YES                     #yes表示/etc/vsftpd/user_list为黑名单,no为白名单,


#If vsftpd is in standalone mode, this is the maximum number of clients which may be connected. Any additional clients connecting will get an error message.  The value 0 switches off the limit.

max_clients                   #限制最大客户端数量


#If vsftpd is in standalone mode, this is the maximum number of clients which may be connected from the same source internet address. A  client  will get an error message if they go over this limit. The value 0 switches off the limit.

max_per_ip                    #限制相同IP的连接客户端数量

对于ftp用户访问ftp服务时应该对其chroot

          禁锢用户于其家目录中

               chroot_local_user={Yes|No}

               chroot_list_enable={YES|NO}

               chroot_list_file=/etc/vsftpd/chroot_list

                    每行一个用户

     匿名用户的配置:

          anonymous_enable=YES

          anon_upload_enable=YES

          anon_other_write_enable=YES

          anon_mkdir_write_enable=YES

          注意:启用写入功能时,ftp用户对相应的本地文件系统也有相应的写入权限;

               生效的权限取决于文件系统权限和服务权限的交集;

     欢迎信息的定义:

          banner_file=/path/to/some_banner_file

          ftp_banner=some string

          dirmessage_enable=yes

               在某ftp可访问的目录下创建.messages文件

     vsftp控制登录用户的机制:

          /etc/vsftpd/ftpusers中的用户都不允许使用ftp服务, 这是在/etc/pam.d/vsftpd中定义;

          user_list配置文件有两种用法:

               黑名单:

                    userlist_enable=YES

                    userlist_deny=YES

               白名单

                    userlist_enable=YES

                    userlist_deny=NO

     连接限制:

          max_clients: 最大并发连接数

          max_per_ip: 每IP可同时发起并发请求

     传输速率:

          anon_max_rate: 匿名用户的最大传输速率,单位是“字节/秒”;

          local_max_rate: 本地用户……………………

     上传文件的umask:

          anno_umask: 匿名用户上传文件的umask;

          local_umask:

     修改匿名用户上传文件的属主和属组:

          chown_uploads=YES

          chown_username=someuser

     虚拟用户:

          所有的虚拟用户会映射会一个系统用户,访问时的文件目录是为此系统用户的家目录;

          虚拟用户:

               hash编码的文件:

                    奇数行为用户名,偶数行为密码

               关系型数据库

                    pam-mysql实现认证

到此,关于“ftp的常用配置文件参数”的学习就结束了,希望能够解决大家的疑惑。理论与实践的搭配能更好的帮助大家学习,快去试试吧!若想继续学习更多相关知识,请继续关注亿速云网站,小编会继续努力为大家带来更多实用的文章!

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

ftp
AI