安装vsftpd的服务器相关软件

  1. 安装vsftpd服务器和客户端
    sudo yum install ftp vsftpd

  2. 安装一个加密工具
    sudo yum install libdb-utils.x86_64

配置vsftpd

  1. 创建vsftpd的登录用户和主目录
    sudo useradd -d /home/myftp -s /sbin/nologin myftp(myftp是ftp的登录用户,替换成你自己的用户)
  2. 修改相应的密码
    passwd myftp
  3. 创建vsftpd虚拟用户
    sudo touch /etc/vsftpd/vftpuser.txt
myftp
myftp 密码
用户2
用户2密码
......

sudo db_load -T -t hash -f /etc/vsftpd/vftpuser.txt /etc/vsftpd/vftpuser.db
4. 添加vsftpd的虚拟用户的验证
sudo vim /etc/pam.d/vsftpd
把account和auth替换了

session    optional     pam_keyinit.so    force revoke
#auth required pam_listfile.so item=user sense=deny file=/etc/vsftpd/ftpusers onerr=succeed
#auth required pam_shells.so
#auth include password-auth
#account include password-auth
auth required pam_userdb.so db=/etc/vsftpd/vftpuser
account required pam_userdb.so db=/etc/vsftpd/vftpuser
session required pam_loginuid.so
session include password-auth
  1. 修改vsftpd的配置文件vsftpd.conf
    sudo vim /etc/vsftpd/vsftpd.conf
    下面的文件删除了注释

# 是否运行匿名登录(NO)
anonymous_enable=NO
# 是否允许本地用户登录
local_enable=YES
# 允许ftp的任何写方式
write_enable=YES
# 文件创建只有的权限是755=(777-022)
local_umask=022
# 是否允许匿名用户上传文件
#anon_upload_enable=YES
# 是否允许匿名用户创建文件或者删除文件
#anon_mkdir_write_enable=YES
# 用户进入目录信息提示
dirmessage_enable=YES
# 是否允许vsftp的日志
xferlog_enable=YES
# Make sure PORT transfer connections originate from port 20 (ftp-data).
connect_from_port_20=YES
#
#chown_uploads=YES
#chown_username=whoever
# 日志文件的路径
xferlog_file=/var/log/xferlog
# 日志文件的格式
xferlog_std_format=YES
#
#idle_session_timeout=600
#
#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 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().
# (Warning! chroot'ing can be very dangerous. If using chroot, make sure that
# the user does not have write access to the top level directory within the
# chroot)
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
#
# 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.
# 只监听ipv4的地址
listen=YES
#
# This directive enables listening on IPv6 sockets. By default, listening
# on the IPv6 "any" address (::) will accept connections from both IPv6
# and IPv4 clients. It is not necessary to listen on *both* IPv4 and IPv6
# sockets. If you want that (perhaps because you want to listen on specific
# addresses) then 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
# 下面是自己添加的
anon_root=/home/pageftp/open
virtual_use_local_privs=YES
guest_enable=YES
guest_username=pageftp
# 虚拟用户的配置文件(可以对每一个虚拟用户进行单独的权限配置)
user_config_dir=/etc/vsftpd/vconf/
chroot_local_user=YES
allow_writeable_chroot=YES
  1. 创建虚拟用户的权限配置
    sudo mkdir /etc/vsftpd/vconf/
    touch 用户1 用户2 ……
    vim 用户1
cmds_allowed=ABOR,ACCT,APPE,CWD,CDUP,DELE,HELP,LIST,MODE,MDTM,MKD,NOOP,NLST,PASS,PASV,PORT,PWD,QUIT,REIN,RETR,RMD,RNFR,RNTO,SITE,SIZE
,STOR,STAT,STOU,STRU,SYST,TYPE,USER
write_enable=yes
download_enable=yes
anon_upload_enable=yes
anon_mkdir_write_enable=yes
anon_other_write_enable=yes
anon_world_readable_only=no
    1. 启动vsftpd服务
      sudo systemctl enable vsftpd
      sudo service vsftpd start

centos7的vsftpd的安装和配置的更多相关文章

  1. Centos7 下的SVN安装与配置

    Centos7 下的SVN安装与配置 1.关闭防火墙 临时关闭防火墙 systemctl stop firewalld 永久防火墙开机自关闭 systemctl disable firewalld 临 ...

  2. Centos7上HBase的安装和配置

    注意事项 HBase配置必须使用主机名,不支持直接配置IP地址.我尝试过,如果不使用主机名直接用IP,会导致HBase连接zk超时. > 设置主机名 hostnamectl set-hostna ...

  3. centos7系统下nginx安装并配置开机自启动操作

    准备工作 我的centos7系统是最小化安装的, 缺很多库, 首先安装必须的运行库 ? 1 2 3 4 5 6 7 8 9 10 11 yum install wget gcc gcc-c++ pcr ...

  4. CentOS7下NFS服务安装及配置固定端口

    CentOS7下NFS服务安装及配置 系统环境:CentOS Linux release 7.4.1708 (Core) 3.10.0-693.el7.x86_64 软件版本:nfs-utils-1. ...

  5. linux下vsftpd的安装及配置使用详细步骤(推荐)

    vsftpd 是“very secure FTP daemon”的缩写,安全性是它的一个最大的特点. vsftpd 是一个 UNIX 类操作系统上运行的服务器的名字,它可以运行在诸如 Linux.BS ...

  6. vsftpd服务安装,配置,限制目录

    一.下载版本:vsftpd-2.0.5-16.el5_4.1.i386.rpm 二.安装:rpm -ivh vsftpd-2.0.5-16.el5_4.1.i386.rpm 三.配置: vsftpd. ...

  7. CentOS 6.5系统使用yum方式安装LAMP环境和phpMyAdmin,mysql8.0.1/mysql5.7.22+centos7,windows mysql安装、配置

    介绍如何在CentOs6.2下面使用YUM配置安装LAMP环境,一些兄弟也很喜欢使用编译的安装方法,个人觉得如果不是对服务器做定制,用yum安装稳定简单,何必去download&make&am ...

  8. Ubuntu 14.04 FTP服务器--vsftpd的安装和配置

    更新源列表 打开"终端窗口",输入"sudo apt-get update"-->回车-->"输入当前登录用户的管理员密码"-- ...

  9. Centos7 中Nginx的安装与配置

    安装与配置 1.安装nginx yum intsall nginxsudo systemctl start nginx 启动服务sudo firewall-cmd --permanent --zone ...

随机推荐

  1. 【Netty】netty学习之nio网络编程的模型

    [一]NIO服务器编程结构 [二]Netty3.x服务端线程模型

  2. [MEF]第02篇 MEF的导入导出契约

    一.演示概述此演示介绍了如何为Export指定导出的协议名和类型,以及如何为Import指定导入的协议名和类型,只有确保导出和导入的协议名和类型相匹配了,才能注入成功,否则注入就会失败.相关下载(屏幕 ...

  3. chrome扩展程序开发之在目标页面执行自己的JS

    大家都知道JS是执行在client的.所以,假设我们自己写一个浏览器的话.是一定能够往下载下来的网页源码中加入js的.可惜我们没有这个能力.只是幸运的是,chrome的扩展程序能够帮我们做到这件事. ...

  4. Linux 之 hugepage 大页内存理论

    HugePages是通过使用大页内存来取代传统的4kb内存页面,使得管理虚拟地址数变少,加快了从虚拟地址到物理地址的映射以及通过摒弃内存页面的换入换出以提高内存的整体性能.尤其是对于8GB以上的内存以 ...

  5. bzoj1087互不侵犯King(状压)

    题目:https://www.lydsy.com/JudgeOnline/problem.php?id=1087 简单的状压dp.但是wa了好几发.注意long long. 注意0和0的连边.而且不能 ...

  6. eclipse git 开发操作流程

    1.eclipse git 开发操作流程 1.1流程简介 1)master主分支,当开发版本得到了充分的验证之后,才能将分支合入master,master为可产品化发布的状态. 2)develop分支 ...

  7. [转]nginx虚拟目录(alias与root的区别)

    今天配置awstats,awstats创建出的文件目录在/home/awstats下,在nginx中加入配置后狂报404,发现还是忽略了root和alias的区别,特将修改配置记录如下: 1.失败:s ...

  8. NetCore下模拟和使用Modbus工业通信协议

    Tips: 1.目前NetCore下与Modbus通信的框架主要选择了 Modbus.Net  https://github.com/parallelbgls/Modbus.Net 2.modbus是 ...

  9. 2、Hive UDF编程实例

    Hive的UDF包括3种:UDF(User-Defined Function).UDAF(User-Defined Aggregate Function)和UDTF(User-Defined Tabl ...

  10. Renesas 符号地址空间对齐

    对齐方式定义头文件:bsp_compiler_support.h #define BSP_SECTION_STACK ".stack" #define BSP_SECTION_HE ...