安装vsftpd
sudo yum install vsftpd
 
配置参数
命令行输入

vim /etc/vsftpd.conf
 
使用如下配置

# Example config file /etc/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.
#
#
# Run standalone?  vsftpd can run either from an inetd or as a standalone
# daemon started from an initscript.
listen=NO
#
# 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.
listen_ipv6=YES
#
# Allow anonymous FTP? (Disabled by default).
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
#
# If enabled, vsftpd will display directory listings with the time
# in  your  local  time  zone.  The default is to display GMT. The
# times returned by the MDTM FTP command are also affected by this
# option.
use_localtime=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.
# Note that the default log file location is /var/log/xferlog in this case.
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 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 restrict local users to their home directories.  See the FAQ for
# the possible risks in this before using chroot_local_user or
# chroot_list_enable below.
#chroot_local_user=YES
#
# 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
user_sub_token=$USER
local_root=/home/$USER/ftp
# (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
#
# Customization
#
# Some of vsftpd's settings don't fit the filesystem layout by
# default.
#
# This option should be the name of a directory which is empty.  Also, the
# directory should not be writable by the ftp user. This directory is used
# as a secure chroot() jail at times vsftpd does not require filesystem
# access.
secure_chroot_dir=/var/run/vsftpd/empty
#
# This string is the name of the PAM service vsftpd will use.
pam_service_name=ftp
#
# This option specifies the location of the RSA certificate to use for SSL
# encrypted connections.
rsa_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
rsa_private_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
ssl_enable=NO

#
# Uncomment this to indicate that vsftpd use a utf8 filesystem.
utf8_filesystem=YES

配置说明
anonymous_enable=NO 拒绝匿名登陆

write_enable=YES 设置可以上传文件,这个设置看需要个人需要

xferlog_enable=YES 开启日志记录

xferlog_file=/var/log/vsftpd.log 设置日志文件路径

xferlog_std_format=YES 设置日志格式为标准输出

connect_from_port_20=YES 绑定20端口

ftpd_banner=Welcome to FTP service. 欢迎语句,在使用shell时可以看到

chroot_local_user=YES

chroot_list_enable=YES

chroot_list_file=/etc/vsftpd.chroot_list
上面的这几个配置实现的功能是:用户被限制在自己的主目录下。用户名单来源于/etc/vsftpd.chroot_list

user_sub_token=$USER

local_root=/home/$USER/ftp
添加一个user_sub_token ,以便插入用户名在我们local_root directory路径,以便我们的配置将为该用户,并可能被添加任何未来的用户

pam_service_name=ftp原配置中为vsftpd,ubuntu用户需要更改成ftp

如果登录后出现如下错误,则在/etc/vsftpd.conf文件内添加allow_writeable_chroot=YES

500 OOPS: vsftpd: refusing to run with writable root inside chroot ()
 
创建ftp用户
mkdir /home/ftpuser
sudo useradd ftpuser -d /home/ftpuser -m
sudo passwd ftpuser
mkdir /home/ftpuser/ftp
chmod 777 -R /home/username/ftp
usermod -s /sbin/nologin ftpuser

/etc/vsftpd.chroot_list要自己创建,并将ftpuser放进去

启动vsftpd或者重启
systemctl start vsftpd 或 service vsftpd start
systemctl restart vsftpd 或 service vsftpd restart
登陆
使用filezilla或者打开文件管理器输入ftp://ipaddress

CentOS7搭建ftp服务器(vsftpd,亲测成功)相关推荐

  1. centos7搭建apache服务器(亲测可用)

    1安装apache yum install httpd httpd-devel -y 2开启服务器 systemctl start httpd.service 3开机自启 systemctl enab ...

  2. ftp linux包,图文详解Ubuntu搭建Ftp服务器的方法(包成功)

    一.今天下午由于课程的要求不得已做了Ubuntu搭建Ftp服务器的实验,但是实验指导书还是N年前的技术,网上搜了一大把,都是模模糊糊的! 在百般困难中终于试验成功,特把经验分给大家 希望大家少走弯路! ...

  3. Centos7安装搭建FTP服务器VSFTPD

    简介: vsftpd 是"very secure FTP daemon"的缩写,安全性是它的一个最大的特点. vsftpd 是一个 UNIX 类操作系统上运行的服务器的名字,它可以 ...

  4. [CentOs7]搭建ftp服务器(2)——添加用户

    摘要 上篇文章完成了ftp服务器的安装与匿名访问的内容,当然出于安全的考虑是不允许匿名访问服务器的,所以就有了本篇的内容 ,为ftp服务器添加用户,用改用户进行访问. vsftpd添加用户 FTP用户 ...

  5. Linux下搭建SVN服务器【亲测可用】

    Linux下搭建SVN服务器 简介 第一步:通过yum命令安装svnserve,命令如下: 第二步:创建版本库目录(此仅为目录,为后面创建版本库提供存放位置) 第三步:创建svn版本库 第四步:配置修 ...

  6. centos7搭建FTP服务器

    1.  使用 yum 安装 vsftpd:yum install -y vsftpd 2. 启动 VSFTPD:systemctl start vsftpd.service 3. 启动后可监听到21端 ...

  7. [CentOs7]搭建ftp服务器(3)——上传,下载,删除,重命名,新建文件夹

    摘要 上篇文章介绍了如何为ftp添加虚拟用户,本篇将继续实践如何上传,下载文件. 上传 使用xftp客户端上传文件,如图所示 此时上传状态报错,查看详情 从错误看出是应为无法创建文件造成的.那么我们就 ...

  8. Ubuntu20.04搭建ftp服务(亲测通过)

    安装: sudo apt-get install vsftpd# 设置开机启动并启动ftp服务 systemctl enable vsftpd systemctl start vsftpd 启动: # ...

  9. 如何在Ubuntu系统 上登录北理工教务处查看选项(转自FTP联盟)亲测成功

    装了Ubuntu,搞弄了半天,装IE7等还是进不去咱校万恶的教务处,听同学讲可以通过改一些代码使Firefox和Chromium等非IE内核的进入教务处并选课和查看课表等功能(之前想找UBUNTU下的 ...

最新文章

  1. 天线的基本原理和概念
  2. module 'cv2' has no attribute 'CV_LOAD_IMAGE_GRAYSCALE'
  3. opencv颜色识别java,Opencv颜色识别与追踪
  4. 广播等风暴的解决办法
  5. 2021中国泛知识付费行业报告
  6. 解锁树莓派root账号
  7. 21.为什么要用swagger,它解决了什么问题?
  8. ubuntu 12.04 以固定 IP 地址连接网络并配置DNS
  9. springmvc国际化 基于请求的国际化配置
  10. C#反编译工具Reflector.exe教程
  11. 三层交换机和链路聚合
  12. 模拟器打开开发者模式
  13. 【Spring Security】Spring Boot + Spring Security 实现自动登录功能
  14. Word/WPS文档中缩小行距
  15. Xamarin效果第二十三篇之离线语音识别
  16. python对小数的特殊处理(个人需求-小数点后有一位保留,否则十分位进1)
  17. BLDC(直流无刷电机)反电动势测量/观测模型
  18. python 处理EXCEL 追加写
  19. 华为路由器:WLAN直连式三层组网实验
  20. 如何在 Mac 上将 PDF 转换为 Word [6 种免费方法]

热门文章

  1. new URI(zk_servers_1) 路径包含下划线无法获取host的问题
  2. vue内引入语音播报功能
  3. 《全球互联网金融商业模式:格局与发展》——第3章,第3节互联网保险公司...
  4. Apache多站点配置详解
  5. Ant 风格路径表达式
  6. 针对Parse error: syntax error, unexpected T_PUBLIC in D:报错提醒
  7. css直接子元素怎么用,CSS 子元素选择器使用实例
  8. 公务员计算机考试题库,公务员考试题库
  9. 城市运行一网统管_【宣传活动】持续开展城市运行“一网统管”建设宣传活动...
  10. Jquery Mobile dialog的生命周期