CentOS 7搭建FTP服务器
安装vsftpd
命令:yum -y install vsftpd
修改ftp配置文件
命令:vim /etc/vsftpd/vsftpd.conf
按i进入insert模式后,按以下要求修改
anonymous_enable=YES
#改为anonymous_enable=NO
chroot_local_user=YES
#去掉前面的注释
#chroot_list_enable=YES
#chroot_list_file=/etc/vsftpd/chroot_list
#不受限制的用户列表,用不用都OK
allow_writeable_chroot=YES
#加上这行解决了无法登陆的问题(重点,不然可能会出现530问题)
重启ftp
systemctl start vsftpd.service
systemctl restart vsftpd.service
设置开机启动ftp
systemctl enable vsftpd.service
配置防火墙(重点!)
#先检查是否安装了iptables
service iptables status
#安装iptables
yum install -y iptables
#升级iptables
yum update iptables
#安装iptables-services
yum install iptables-services
禁用/停止自带的firewalld服务
#停止firewalld服务
systemctl stop firewalld
#禁用firewalld服务
systemctl mask firewalld
设置现有规则
#查看iptables现有规则
iptables -L -n
#先允许所有,不然有可能会杯具
iptables -P INPUT ACCEPT
#清空所有默认规则
iptables -F
#清空所有自定义规则
iptables -X
#所有计数器归0
iptables -Z
#允许来自于lo接口的数据包(本地访问)
iptables -A INPUT -i lo -j ACCEPT
#开放22端口
iptables -A INPUT -p tcp --dport 22 -j ACCEPT
#开放21端口(FTP)
iptables -A INPUT -p tcp --dport 21 -j ACCEPT
#开放80端口(HTTP)
iptables -A INPUT -p tcp --dport 80 -j ACCEPT
#开放443端口(HTTPS)
iptables -A INPUT -p tcp --dport 443 -j ACCEPT
#允许ping
iptables -A INPUT -p icmp --icmp-type 8 -j ACCEPT
#允许接受本机请求之后的返回数据 RELATED,是为FTP设置的
iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
#其他入站一律丢弃
iptables -P INPUT DROP
#所有出站一律绿灯
iptables -P OUTPUT ACCEPT
#所有转发一律丢弃
iptables -P FORWARD DROP
其他规则设定
#如果要添加内网ip信任(接受其所有TCP请求)
iptables -A INPUT -p tcp -s 45.96.174.68 -j ACCEPT
#过滤所有非以上规则的请求
iptables -P INPUT DROP
#要封停一个IP,使用下面这条命令:
iptables -I INPUT -s ***.***.***.*** -j DROP
#要解封一个IP,使用下面这条命令:
iptables -D INPUT -s ***.***.***.*** -j DROP
保存规则设定
#保存上述规则
service iptables save
开启iptables服务
#注册iptables服务
#相当于以前的chkconfig iptables on
systemctl enable iptables.service
#开启服务
systemctl start iptables.service
#查看状态
systemctl status iptables.service
重启防火墙
命令:systemctl restart iptables.service
建立ftp账户
useradd -d /home/ftp -s /sbin/nologin ftpadmin
修改密码
命令:passwd ftpadmin
#注意 ftpadmin为刚刚设定的用户名,输入两次密码即可
设置用户权限
chmod 777 /home/ftp
重启ftp
systemctl restart vsftpd.service
ok,ftp服务器搭建完成
CentOS 7搭建FTP服务器的更多相关文章
- CentOS 下搭建FTP服务器
vsftpd是Linux下比较著名的FTP服务器,搭建FTP服务器当然首选这个.本文介绍了在CentOS 6 4下安装vsftpd.配置虚拟用户登录FTP的过程.正 vsftpd是Linux下比较著名 ...
- Centos下搭建ftp服务器
完全不用那么麻烦,直接可以用xshell中自带的传输文件功能,下载客户端xftp安装就行,不用配置,可以在windows系统向Linux系统的任何文件地方上传下载文件,简单方便,大大节约时间, vsf ...
- centos 6 搭建ftp服务器支持匿名读写
转载请注明: 凌云物网智科嵌入式实验室: http://iot-yun.com/ 郭文学<guowenxue@gmail.com> vsftpd在运行时一定要关闭SELinux,否 ...
- 在阿里云主机上基于CentOS用vsftpd搭建FTP服务器
最近需要在一台阿里云的云服务器上搭建FTP服务器,在这篇博文中分享一下我们根据实际需求进行的一些配置. ftp软件用的是vsftpd. vsftpd是一款在Linux发行版中最受推崇的FTP服务器程序 ...
- (转)Centos搭建FTP服务器
场景:ftp服务器对于在Linux服务器上进行文件操作太方便,在安装软件时候,大的软件也可以先上传再进行安装! 1 搭建FTP服务器 1.1 检查vsftpd 查看是否已经安装vsftpd rpm - ...
- 服务器linux centos 7.4 搭建ftp服务器
此操作是在腾讯云服务器linux centos 7.4 完成搭建ftp服务器 vsftpd 的: 安装 vsftpd $ yum install vsftpd -y 启动 $ service vsft ...
- CentOS 6.5下快速搭建ftp服务器[转]
CentOS 6.5下快速搭建ftp服务器 1.用root 进入系统 2.使用命令 rpm -qa|grep vsftpd 查看系统是否安装了ftp,若安装了vsftp,使用这个命令会在屏幕上显示vs ...
- CentOS 6.5下快速搭建ftp服务器
来源:Linux社区 作者:Linux CentOS 6.5下快速搭建ftp服务器 1.用root 进入系统 2.使用命令 rpm -qa|grep vsftpd 查看系统是否安装了ftp,若安装了v ...
- CenOS搭建FTP服务器
CenOS搭建FTP服务器 -------------------------------------------------------------------------准备工作--------- ...
随机推荐
- mysql 优化(3)
using filesort 不能利用索引来进行分组或排序,利用filesort算法在内存或者磁盘进行排序using temporary 先在内存中进行分组,归并等操作,不够利用磁盘 SELECT i ...
- 在centOS5.9安装mysql
网上的信息实在是太乱了,好多出了错的,我这个是自己亲自配置,其实就简简单单的几步:如果你的系统里有以前遗留的文件,用rm -rf文件名删除掉 1.安装MySQL客服端和服务器端 ...
- (转) C#中Timer使用及解决重入(多线程同时调用callback函数)问题
原文链接: http://www.cnblogs.com/hdkn235/archive/2014/12/27/4187925.html
- laravel-ide-helper 遇到There are no commands defined问题怎么解决
laravel门面类的代码提示方案: https://github.com/barryvdh/laravel-ide-helper 按照步骤安装 1.composer require barryvdh ...
- 搭建psdash 监控系统
一.监控系统介绍 Psdash 是一款查看 Linux 系统信息的 web 面板,和另一款系统监控工具 Glances 一样,psDash 的系统信息的采集也是由 psutil 完成的.和 Glanc ...
- angularJs中的发送请求例子
$http({ //发送请求 url: 'http://localhost:8080/teacher/api/login', method: 'post', data: obj }) .success ...
- springMVC 踩过的坑 - 记录
1. 后台持久层Spring Jpa(即hibernate), 前台angularJS(angularJS只接受json串), 在后台使用DTO层对象代替domain(entity)与前台交互时, 传 ...
- redis hash结构如何设置过期时间
Redis中有个设置时间过期的功能,即通过setex或者expire实现,目前redis没有提供hsetex()这样的方法,redis中过期时间只针对顶级key类型,对于hash类型是不支持的,这个时 ...
- Django-组件--用户认证Auth(auth_user增加字段)
引入: from django.db import models from django.contrib.auth.models import AbstractBaseUser 源码 : from d ...
- spring-boot-maven-plugin 插件的作用
pom文件中添加了"org.springframework.boot:spring-boot-maven-plugin"插件.在添加了该插件之后,当运行"mvn pack ...