0. 关闭selinux

  1. 永久性关闭(这样需要重启服务器后生效)
  2. sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
  3. 临时性关闭(立即生效,但是重启服务器后失效)
  4. setenforce 0 #设置selinux为permissive模式(即关闭)
  5. setenforce 1 #设置selinux为enforcing模式(即开启)

1. 查看是否安装

  1. rpm -qa | grep vsftp

2. 安装vsftp

  1. yum install vsftpd -y

3. 修改主配置文件

  1. # Example config file /etc/vsftpd/vsftpd.conf
  2. #
  3. # The default compiled in settings are fairly paranoid. This sample file
  4. # loosens things up a bit, to make the ftp daemon more usable.
  5. # Please see vsftpd.conf.5 for all compiled in defaults.
  6. #
  7. # READ THIS: This example file is NOT an exhaustive list of vsftpd options.
  8. # Please read the vsftpd.conf.5 manual page to get a full idea of vsftpd's
  9. # capabilities.
  10. #
  11. # 是否允许匿名登录FTP服务器,默认设置为YES(允许)
  12. anonymous_enable=NO
  13. #
  14. # 是否允许本地用户登录FTP服务器,默认设置为YES(允许)
  15. local_enable=YES
  16. #
  17. # 是否允许用户(匿名用户、本地用户)对FTP服务器具有写权限,默认设置为YES(允许)
  18. write_enable=YES
  19. #
  20. # Default umask for local users is 077. You may wish to change this to 022,
  21. # if your users expect that (022 is used by most other ftpd's)
  22. # 设置本地用户的文件生成掩码,默认为022
  23. local_umask=022
  24. #
  25. # Uncomment this to allow the anonymous FTP user to upload files. This only
  26. # has an effect if the above global write enable is activated. Also, you will
  27. # obviously need to create a directory writable by the FTP user.
  28. # 是否允许匿名用户上传文件,默认设置为YES(允许)。
  29. #anon_upload_enable=YES
  30. #
  31. # Uncomment this if you want the anonymous FTP user to be able to create
  32. # new directories.
  33. # 是否允许匿名用户创建新文件夹。默认设置为YES(允许)
  34. #anon_mkdir_write_enable=YES
  35. #
  36. # Activate directory messages - messages given to remote users when they
  37. # go into a certain directory.
  38. # 是否激活目录欢迎信息功能,当用户首次访问服务器上的某个目录时,FTP服务器将显示欢迎信息。默认情况下,欢迎信息是通过目录下的.message文件获得的
  39. dirmessage_enable=YES
  40. #
  41. # The target log file can be vsftpd_log_file or xferlog_file.
  42. # This depends on setting xferlog_std_format parameter
  43. # 是否启用上传和下载记录日志的功能
  44. xferlog_enable=YES
  45. # 在FTP服务器中设置欢迎登录信息。当用户登录到FTP服务器后,会看到欢迎细信息“Welcome to blah FTP service.”
  46. ftpd_banner=Welcome to blah FTP service
  47. #
  48. # Make sure PORT transfer connections originate from port 20 (ftp-data).
  49. connect_from_port_20=YES
  50. #
  51. # If you want, you can arrange for uploaded anonymous files to be owned by
  52. # a different user. Note! Using "root" for uploaded files is not
  53. # recommended!
  54. #chown_uploads=YES
  55. #chown_username=whoever
  56. #
  57. # The name of log file when xferlog_enable=YES and xferlog_std_format=YES
  58. # WARNING - changing this filename affects /etc/logrotate.d/vsftpd.log
  59. xferlog_file=/var/log/xferlog
  60. #
  61. # Switches between logging into vsftpd_log_file and xferlog_file files.
  62. # NO writes to vsftpd_log_file, YES to xferlog_file
  63. xferlog_std_format=YES
  64. #
  65. # You may change the default value for timing out an idle session.
  66. # 如果用户在600秒内没有命令操作,强制脱机,避免占用资源
  67. idle_session_timeout=600
  68. #
  69. # You may change the default value for timing out a data connection.
  70. # 如果服务器和客户端的数据连接已经成功建立,但是可能由于线路问题导致在120秒内还是无法顺利地完成数据的传送,客户端的连接就会被vsftpd强制剔除
  71. #data_connection_timeout=120
  72. #
  73. # It is recommended that you define on your system a unique user which the
  74. # ftp server can use as a totally isolated and unprivileged user.
  75. #nopriv_user=ftpsecure
  76. #
  77. # Enable this and the server will recognise asynchronous ABOR requests. Not
  78. # recommended for security (the code is non-trivial). Not enabling it,
  79. # however, may confuse older FTP clients.
  80. #async_abor_enable=YES
  81. #
  82. # By default the server will pretend to allow ASCII mode but in fact ignore
  83. # the request. Turn on the below options to have the server actually do ASCII
  84. # mangling on files when in ASCII mode.
  85. # Beware that on some FTP servers, ASCII support allows a denial of service
  86. # attack (DoS) via the command "SIZE /big/file" in ASCII mode. vsftpd
  87. # predicted this attack and has always been safe, reporting the size of the
  88. # raw file.
  89. # ASCII mangling is a horrible feature of the protocol.
  90. # 当设置为YES时,表示允许使用ASCII方式上传和下载文件
  91. #ascii_upload_enable=YES
  92. #ascii_download_enable=YES
  93. #
  94. # You may fully customise the login banner string:
  95. #ftpd_banner=Welcome to blah FTP service.
  96. #
  97. # You may specify a file of disallowed anonymous e-mail addresses. Apparently
  98. # useful for combatting certain DoS attacks.
  99. #deny_email_enable=YES
  100. # (default follows)
  101. #banned_email_file=/etc/vsftpd/banned_emails
  102. #
  103. # You may specify an explicit list of local users to chroot() to their home
  104. # directory. If chroot_local_user is YES, then this list becomes a list of
  105. # users to NOT chroot().
  106. #chroot_local_user=YES
  107. #是否锁定根目录(只能在指定给自己的目录下做为根目录)
  108. #每行写FTP用户名就行
  109. chroot_list_enable=YES
  110. #允许写入
  111. #allow_writeable_chroot=YES
  112. # (default follows)
  113. # 锁定FTP用户在自己目录下面,不写入的话有可能会直接显示根目录!
  114. chroot_list_file=/etc/vsftpd/chroot_list
  115. #
  116. # You may activate the "-R" option to the builtin ls. This is disabled by
  117. # default to avoid remote users being able to cause excessive I/O on large
  118. # sites. However, some broken FTP clients such as "ncftp" and "mirror" assume
  119. # the presence of the "-R" option, so there is a strong case for enabling it.
  120. #ls_recurse_enable=YES
  121. #
  122. # When "listen" directive is enabled, vsftpd runs in standalone mode and
  123. # listens on IPv4 sockets. This directive cannot be used in conjunction
  124. # with the listen_ipv6 directive.
  125. # 当设置为YES时,则vsftpd将以独立模式运行,由vsftpd自己监听和处理连接请求
  126. listen=YES
  127. #
  128. # This directive enables listening on IPv6 sockets. To listen on IPv4 and IPv6
  129. # sockets, you must run two copies of vsftpd with two configuration files.
  130. # Make sure, that one of the listen options is commented !!
  131. #listen_ipv6=YES
  132.  
  133. pam_service_name=vsftpd
  134. # userlist_enable=NO时ftpusers文件中的用户将禁止访问FTP服务器。因此ftpusers文件又被称为“禁止使用vsftpd的用户列表文件”
  135. userlist_enable=YES
  136. # 当userlist_enable为YES,userlist_deny为NO时,FTP服务器仅允许user_list中的用户访问
  137. # 当userlist_enable为YES,userlist_deny为YES时,ftpusers和user_list文件中的用户均不能访问FTP服务器
  138. # userlist_deny
  139. tcp_wrappers=YES
  140. #用来存放每个需要独立的FTP用户的配置
  141. user_config_dir=/etc/vsftpd/userconfig
  142. #centos7 开启
  143. #allow_writeable_chroot=YES

备份原配置文件后直接复制即可,创建虚拟用户

  1. vim /etc/vsftpd/chroot_list
  2. ftpuser

4. 指定用户根目录

  1. mkdir /etc/vsftpd/userconfig
  2. echo local_root=/var/ftp/ftpuser > /etc/vsftpd/userconfig/ftpuser

5. 创建用户

  1. useradd -s /sbin/nologin -g ftp ftpuser && echo 你的密码 | passwd --stdin ftpuser

6. 创建用户FTP所能管理的目

  1. mkdir /var/ftp/ftpuser
  2. #把所建的目录给相应的账号主权限
  3. chown -R ftpuser:ftp /var/ftp/ftpuser

7. 关闭防火墙

  1. # 注意linux的版本
  2.  
  3. # CentOs 6
  4. # 查看防火墙是否开启
  5. service iptables status
  6. # 临时关闭防火墙
  7. servcie iptables stop
  8. # 永久性关闭防火墙
  9. service iptables off
  10.  
  11. # CentOs 7+
  12. # 查看防火墙是否开启
  13. firewall-cmd --state
  14. #临时关闭防火墙
  15. systemctl stop firewalld.service
  16. #永久关闭防火墙(重启生效)
  17. systemctl disable firewalld.service

8. 启动VSFTP服务

  1. service vsftpd start

CenOS_6.6_简单搭建vsFTP的更多相关文章

  1. 基于腾讯云centos简单搭建VSFTP

    基于腾讯云centos7.3搭建VSFTP 环境分析: 基于vsftp服务在于云主机上,所以推荐使用FTP的PASV模式: FTP协议有两种工作方式:PORT方式和PASV方式,中文意思为主动式和被动 ...

  2. python简单搭建HTTP Web服务器

    对于Python 2,简单搭建Web服务器,只需在i需要搭建Web服务器的目录(如C:/ 或 /home/klchang/)下,输入如下命令: python -m SimpleHTTPServer 8 ...

  3. springmvc4环境简单搭建和定时任务

    之前复制粘贴创建了几个ssm的项目,然而回头让自己写的时候还是一头雾水,究其原因是spring的陌生.仅仅是写过几个helloworld而已.而且是照着写.我都不知道springmvc到底需要多少ja ...

  4. 1.0、Struts2的简单搭建方法

    一.Struts2:是一个基于MVC设计模式的Web应用框架,它本质上相当于一个servlet:用于jsp页面与Java代码之间的交互. 1.核心:Filter拦截器,对所有的请求进行拦截. 2.工作 ...

  5. 零配置简单搭建SpringMVC 项目

    SpringMVC是比较常用的JavaWeb框架,非常轻便强悍,能简化Web开发,大大提高开发效率,在各种Web程序中广泛应用.本文采用Java Config的方式搭建SpringMVC项目,并对Sp ...

  6. Ubuntu学习笔记-win7&Ubuntu双系统简单搭建系统指南

    win7&Ubuntu双系统简单搭建系统指南 本文是自己老本子折腾Ubuntu的一些记录,主要是搭建了一个能够足够娱乐(不玩游戏)专注练习自己编程能力的内容.只是简单的写了关于系统的安装和一些 ...

  7. 快速搭建vsftp 服务器并配置指定目录

    1  搭建vsftp 服务器 前期准备: 1.用root 进入系统 2.使用命令 rpm  -qa|grep vsftpd 查看系统是否安装了ftp,若安装了vsftp,使用这个命令会在屏幕上显示vs ...

  8. centos 7.2下搭建vsftp 虚拟用户

    虚拟用户搭建vsftp 要求一: 只允许上传 下载 不能删除 不能更换名称 yum install pam* yum install db4* -y yum install vsftpd chkcon ...

  9. python 简单搭建非阻塞式单进程,select模式,epoll模式服务

    由于经常被抓取文章内容,在此附上博客文章网址:,偶尔会更新某些出错的数据或文字,建议到我博客地址 :  --> 点击这里 可以看我的上篇文章 <python 简单搭建阻塞式单进程,多进程, ...

随机推荐

  1. day81

    昨日回顾: 昨日回顾: auth组件: -验证:authenticat(request,username=') -登录:login(request,user) -注销:logout(request), ...

  2. SPOJ Qtree系列 5/7

    Qtree1 树剖裸题 注意把边权移到深度较深的点上,树剖跳的时候不要将LCA的答案统计上就行了 #include<stdio.h> #include<string.h> #d ...

  3. Python高级特性(切片,迭代,列表生成式,生成器,迭代器)

    掌握了Python的数据类型.语句和函数,基本上就可以编写出很多有用的程序了. 比如构造一个1, 3, 5, 7, ..., 99的列表,可以通过循环实现: L = [] n = 1 while n ...

  4. Spark在Windows下的环境搭建(转)

    原作者:xuweimdm   原文网址:http://blog.csdn.net/u011513853/article/details/52865076 由于Spark是用Scala来写的,所以Spa ...

  5. Appium Studio 初体验(windows做ios自动化,录制appium脚本)

    偶然的机会遇到了这个工具——Appium Studio, 在官网是这么解释的 Get your Appium testing projects going within minutesInstall ...

  6. Java各厂对外的优质博客

    1.美团:https://tech.meituan.com/ 2.极客学院:http://wiki.jikexueyuan.com/list/java/

  7. Unity Jobsystem 详解实体组件系统ECS

    原文摘选自Unity Jobsystem 详解实体组件系统ECS 简介 随着ECS的加入,Unity基本上改变了软件开发方面的大部分方法.ECS的加入预示着OOP方法的结束.随着实体组件系统ECS的到 ...

  8. 最近新明白的SQL小知识

    1.partition by和order by 先看三个小需求: ①查询出各个类编号的书本的数量. select count (类编号) as 数量, 类编号 from Books group by ...

  9. VS2013软件的安装和单元测试

    VS2013是什么? 微软在Builder 2013开发者大会上发布了Visual Studio 2013预览版,并且发布其程序组件库.NET 4.5.1的预览版.该软件已于北京时间2013年11月1 ...

  10. Pair Project —— Elevator Scheduler

    结对编程人员 12061153 刘丽萍 12061154 冯飘飘 说明结对编程的优点和缺点. 结对编程的优点: 以前都是自己一个人编程,对于相互结对或者团队编程都没有接触过.而自己在写代码时不可避免的 ...