1. vsftp简介:
  VSFTP是一个基于GPL发布的类Unix系统上使用的FTP服务器软件,它的全称是Very Secure FTP 从此名称可以看出来,编制者的初衷是代码的安全。

  安全性是编写VSFTP的初衷,除了这与生俱来的安全特性以外,高速与高稳定性也是VSFTP的两个重要特点。

  在速度方面,使用ASCII代码的模式下载数据时,VSFTP的速度是Wu-FTP的两倍,如果Linux主机使用2.4.*的内核,在千兆以太网上的下载速度可达86MB/S。

  在稳定方面,VSFTP就更加的出色,VSFTP在单机(非集群)上支持4000个以上的并发用户同时连接,根据Red Hat的Ftp服务器(ftp.redhat.com)的数据,VSFTP服务器可以支持15000个并发用户。
  1. vsftp的安装配置:
安装vsftp需要用到root权限,尽可能的在root用户下进行安装
切换root权限 sudo su - 1. 检查vsftp是否安装
rpm -qa vsftp [无结果表明没有安装] 2. 安装vsftp
yum install -y vsftpd
[root@m01 ~]# yum install -y vsftpd
Loaded plugins: fastestmirror, security
Setting up Install Process
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
Resolving Dependencies
--> Running transaction check
---> Package vsftpd.x86_64 0:2.2.2-24.el6 will be installed
--> Finished Dependency Resolution
...
Installed:
vsftpd.x86_64 0:2.2.2-24.el6 Complete! --- 安装完成 3. 创建一个日志文件来记录ftp上传下载的记录
touch /var/log/vsftpd.log 检查vsftp开机启动选项[yum安装后会自动添加开机启动,但是并没有配置,如果需要开机启动则进行配置]
查看开机启动: chkconfig --list|grep vsftpd [root@m01 ~]# chkconfig --list|grep vsftpd
vsftpd 0:off 1:off 2:off 3:off 4:off 5:off 6:off 设置35级别开机启动:
[root@m01 ~]# chkconfig --level 35 vsftpd on
[root@m01 ~]# chkconfig --list | grep vsftpd
vsftpd 0:off 1:off 2:off 3:on 4:off 5:on 6:off 3.服务的启动关闭
方式1:
vsftpd安装完成后会默认添加到系统服务和init中 所以可以使用以下方法查看和启动服务
/etc/init.d/vsftpd status | [/etc/init.d/vsftpd {start|stop|restart|try-restart|force-reload|status}] 常用 start|stop|restart 这3个 方式2:
[root@m01 ~]# service vsftpd status [start|stop|restart|try-restart|force-reload|status]
vsftpd is stopped
一般常用 start|stop|restart
start 启动
stop 停止
restart 重新启动 4.vsftp配置权限
了解配置权限之前需要先了解配置文件,如何查看配置文件?
rpm -ql vsftpd 命令可以看到软件安装路径,以及配置文件 重要的配置文件:
/etc/vsftpd/ftpusers ---禁止登录用户的黑名单列表
/etc/vsftpd/user_list ---允许登录的用户白名单列表
/etc/vsftpd/vsftpd.conf ---vftp的重要配置信息 问题:
这里看到两个user,那么ftpusers和user_list两个文件各自的用途是什么?有何关系?
ftpusers 这是一个黑名单用户列表,也就是禁止登录的 比如可以设置 root禁止登录来保证ftp安全
来看下这个配置文件让你更加清晰你在做什么: [root@m01 ~]# cat /etc/vsftpd/ftpusers
# Users that are not allowed to login via ftp
root
bin
daemon
adm
lp
sync
shutdown
halt
mail
news
uucp
operator
games
nobody 这些都是被禁止登录的用户 5. vsftpd.conf 配置文件
这里东西较多,理解就好
先来查看配置并解释: vim /etc/vsftpd/vsftpd.conf
==========================vsftpd.conf===========================================
# 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
# 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 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().
#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.
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
==================================================================================== 看起来很多,如果解释完过滤出需要配置的 你会发现也没多少
[root@m01 ~]# grep -v "#" /etc/vsftpd/vsftpd.conf 【过滤出的都是默认配置】 anonymous_enable=YES ----匿名用户 yes 为允许 no为拒绝 //不允许匿名用户访问,默认是允许
local_enable=YES ----本地模式是否开启 yes 开机 no 关闭 这里默认即可 不需要修改 就是验证本地用户用的
write_enable=YES ----是否开启写入权限 默认yes
local_umask=022 ----umask值 这是设置权限的掩码,默认即可
dirmessage_enable=YES ----这是登录是否显示进入目录标语 默认即可
xferlog_enable=YES ----日志功能 这个默认开启 日志地址/var/log/vsftpd.log
connect_from_port_20=YES ----默认连接端口 不用改
xferlog_std_format=YES ----用于设置vsftpd的服务日志保存路径,不用改
listen=YES pam_service_name=vsftpd ----设定pam服务下vsftpdd的验证配置文件名,不用改
userlist_enable=YES ----拒绝登录用户名单,不用改
TCP_wrappers=YES ----限制主机对VSFTP服务器的访问,不用改(通过/etc/hosts.deny和/etc/hosts.allow这两个文件来配置) 配置ftp账户:
1、修改/etc/vsftpd/vsftpd.conf,将底下三行 #chroot_list_enable=YES
# (default follows)
#chroot_list_file=/etc/vsftpd.chroot_list
改为 chroot_list_enable=YES
# (default follows)
chroot_list_file=/etc/vsftpd/chroot_list 2、增加用户ftpuser,指向目录/home/wwwroot/ftpuser,禁止登录SSH权限。 useradd -d /home/wwwroot/ftpuser -g ftp -s /sbin/nologin ftpuser 3、设置用户口令
passwd ftpuser 4、编辑文件chroot_list(内容为ftp用户名,每个用户占一行):
vi /etc/vsftpd/chroot_list 启用pasv模式
pasv_enable=YES #启用被动模式
pasv_min_port=10000 #被动模式使用端口范围
pasv_max_port=10010 #被动模式使用端口范围 第五步、针对第四步开启防火墙端口,如果没有启用pasv模式就可以不用管 -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 10000:10010 -j ACCEPT
在以上工序完成后,连接ftp时出现了个错误
500 OOPS: vsftpd: cannot locate user specified in 'ftp_username':ftp
经过网络搜索,得到下面的解决办法
在/etc/vsftpd.conf中添加一行ftp_username=nobody就搞定
ftp测试连接
在连接之前要确认是否安装了ftp命令
rpm -qa ftp 没有安装就直接安装
yum install -y ftp 安装完成测试连接ftp服务器
[root@db01 ~]# ftp 10.0.0.61
Connected to 10.0.0.61 (10.0.0.61).
220 (vsFTPd 2.2.2)
Name (10.0.0.61:root): ftpuser
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp>
# 方法一
# 创建用户 ftpuser 指定 `/home/vsftpd` 目录
useradd -g root -M -d /home/vsftpd -s /sbin/nologin ftpuser # 设置用户 ftpuser 的密码
passwd ftpuser # 把 /home/vsftpd 的所有权给ftpuser.root
mkdir /home/vsftpd -p
chown -R ftpuser.root /home/vsftpd # 方法二
useradd ftpuser -d /home/vsftpd -s /bin/false
chown ftpuser:ftpuser /home/vsftpd -R # 如果虚拟用户的宿主用户为www,需要这样设置
# www目录是你应用的目录
chown www:www /home/www -R

ftp上传下载操作命令:

bin  二进制传输模式
prompt 上传提示开关 多文件上传建议改为off
mput 上传
mget 下载 上传下载均可以使用* 进行通配
lcd 切换本地目录
cd 切换ftp目录
登录演示:
ftp 10.0.0.61
Connected to 10.0.0.61 (10.0.0.61).
220 (vsFTPd 2.2.2)
Name (10.0.0.61:root): ftpuser
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp>
ftp>
ftp> ls
227 Entering Passive Mode (10,0,0,61,156,196).
150 Here comes the directory listing.
226 Directory send OK.

vsftp配置使用的更多相关文章

  1. Vsftp的PASV mode(被动模式传送)和Port模式及 Linux下VsFTP配置全方案

    什么叫做PASV mode(被动模式传送)?他是如何工作的? FTP的连接一般是有两个连接的,一个是客户程和服务器传输命令的,另一个是数据传送的连接.FTP服务程序一般会支持两种不同的模式,一种是Po ...

  2. vsftp配置日志及其启用本地时间

    vsftp配置日志及其启用本地时间 1. 启用vsftp日志 xferlog_enable=YES xferlog_std_format=YES xferlog_file=/var/log/xferl ...

  3. Ubuntu14.04(nginx+php+mysql+vsftp)配置安装流程

    Ubuntu14.04(nginx+php+mysql+vsftp)配置安装流程 1.先切换到root用户 sudo  su 2.更新软件源 apt update apt-get upgrade 3. ...

  4. vsftp 配置

    安装和基本配置网上很多文章,但他们的最终效果不是我想要的: 我想要的是,ftp上传的文件用户可以通过apache的http服务访问,也就是ftp上传的文件可以通过浏览器访问,并且可以通过ftp客户端修 ...

  5. centos7.0 vsftp配置

    7.0版本 1.安装 yum -y install vsftpd 2.配置 vi /etc/vsftpd/vsftpd.conf anonymous_enable=NO //设定不允许匿名访问 loc ...

  6. VSFTP 配置虚拟用户

    虚拟用户的特点是只能访问服务器为其提供的FTP服务,而不能访问系统的其它资源.所以,如果想让用户对FTP服务器站内具有写权限,但又不允许访问系统其它资源,可以使用虚拟用户来提高系统的安全性. 在VSF ...

  7. vsftp配置

    网上很多,但我还是想再整理一份属于自己的 1.vsftp简介 vsftp提供三种登陆方式:.匿名登录 .本地用户登录 .虚拟用户登录 vsftpd的特点:.较高的安全性需求 .带宽的限制 .创建支持虚 ...

  8. LINUX VSFTP配置及安装

    ------------------转载:亲身实践,确实好用(http://www.cnblogs.com/jack-Star/p/4089547.html) 1.VSFTP简介 VSFTP是一个基于 ...

  9. linux vsftp配置

    1.rpm -q ftp 查看是否安装ftp服务器 2.yum install vsftp 安装ftp服务器 3.修改配置文件/etc/vsftpd 下面的 ftpusers和user_list,这两 ...

  10. Linux vsftp配置本地用户

    主要讲的是配置本地用户, ftp现在用的也少了,一般都用ssh和svn 1. 安装ftp  yum -y install vsftpd 2. 配置 /etc/vsftpd/vsftpd.conf # ...

随机推荐

  1. docker 应用篇————docker原理[三]

    前文 前面就已经介绍了docker的安装,在https://www.cnblogs.com/aoximin/p/12906218.html,这里面,这里作为重新整理. 那么这里就不介绍了,这里直接是进 ...

  2. nginx 均衡负载

    前言 在此只介绍一些nginx的简单的负载均衡. 正文 在这篇之前,请看我的nginx反向代理这一篇,是接着上面的例子写的. 我在上个例子中,分别是两个a.html 和 b.html 现在我把他们的名 ...

  3. RC4Drop加密技术:原理、实践与安全性探究

    第一章:介绍 1.1 加密技术的重要性 加密技术在当今信息社会中扮演着至关重要的角色.通过加密,我们可以保护敏感信息的机密性,防止信息被未经授权的用户访问.窃取或篡改.加密技术还可以确保数据在传输过程 ...

  4. node统计指定文件夹内代码行数

    1. 来源 想对于自己接触前端日常学习与思考的代码行数进行一个统计,看自己大约敲了多少代码 2.代码 const fs = require('fs') const path = require('pa ...

  5. 应用容灾中,MySQL数据表是否需要跨云同步?

    简介: 容灾系统的重要目标在于保证系统数据和服务的"连续性".当系统发生故障时,容灾系统能够快速恢复服务和保证数据的有效性.为了防止天灾人祸.不可抗力,在同城或异地建立对应的IT系 ...

  6. 工商银行分布式服务 C10K 场景解决方案

    简介: Dubbo 是一款轻量级的开源 Java 服务框架,是众多企业在建设分布式服务架构时的首选.中国工商银行自 2014 年开始探索分布式架构转型工作,基于开源 Dubbo 自主研发了分布式服务平 ...

  7. Dataphin功能:集成——如何将业务系统的数据抽取汇聚到数据中台

    ​简介: 数据集成是简单高效的数据同步平台,致力于提供具有强大的数据预处理能力.丰富的异构数据源之间数据高速稳定的同步能力,为数据中台的建设打好坚实的数据基座. 数据中台是当下大数据领域最前沿的数据建 ...

  8. dotnet 6 已知问题 ManualResetEventSlim 的 Set 方法抛出空异常

    本文记录一个 dotnet 6 已知问题,此问题预计是在 .NET Framework 4.5 时就引入的,我没有考古在 .NET Framework 4.5 之前是否还存在此问题.当前这个问题在 . ...

  9. MAUI 自定义绘图入门

    在2022的5月份,某软正式发布了 MAUI 跨平台 UI 框架.我本来想着趁六一儿童节放假来写几篇关于 MAUI 入门的博客,可惜发现我不擅长写很入门的博客.再加上 MAUI 似乎是为了赶发布日期而 ...

  10. 深入浅出玩转fPGA-读书笔记

    笔记1 关于异步复位同步释放的理解 先看代码: 其中有两个always语句,把2个触发器叠加,当按下复位信号rst_n是,两个触发器都复位(清零).当rst_n释放时,重点就来了,rst_n释放的时刻 ...