Linux 之CentOS7-VSFTP搭建
- 环境
1、俩台Linux 虚拟机 Ser 和 Cli
- 安装
[root@jm ~]# rpm -ivh /mnt/Packages/vsftpd-3.0.2-10.el7.x86_64.rpm //Ser 上安装
[root@jm ~]# yum install -y lftp //Cli 上安装Client 端
- 配置
/etc/vsftpd/vsftpd.conf //主配置文件
/etc/vsftpd/ftpusers //黑名单
/etc/vsftpd/user_list //白名单
/etc/vsftpd/vsftpd_conf_migrate.sh //变量和脚本
/var/ftp //默认虚拟用户的根目录
[root@jm ~]# systemctl start vsftpd //启动服务
[root@jm ~]# systemctl enable vsftpd //设置开机自启动
[root@jm ~]# netstat -antup | grep ftp //查看FTP端口
[root@jm ~]# netstat -tlunp | grep 53 //查看端口
[root@jm ~]# vim /etc/services // services 文件 ,查看服务端口
[root@jm ~]# systemctl stop iptables //关闭 iptables
[root@jm ~]# chkconfig iptables off //iptables 开机不启动
[root@jm ~]# getenforce // 临时关闭selinux
[root@jm ~]# vim /etc/sysconfig/selinux
SELINUX=enforcing 改为 SELINUX=disabled 重启reboot //永久关闭selinux
1、客户端使用
[root@jm ~]# rpm -ivh /mnt/Packages/lftp-4.4.8-7.el7.x86_64.rpm //安装客户端
[root@jm ~]# lftp 192.168.1.10 //登陆 FTP 服务器
ftp://192.168.1.10/ //windows登陆FTP
2、修改配置文件
[root@jm ~]# cd /etc/vsftpd/
[root@jm vsftpd]# cp vsftpd.conf{,.bak} //使用命令展开式,FTP配置文件备份
[root@jm vsftpd]# vim /etc/vsftpd/vsftpd.conf //编辑配置文件
3、允许匿名访问实例
anonymous_enable=YES //开启允许匿名访问
anon_upload_enable=YES //开启允许匿名上传
anon_mkdir_write_enable=YES //开启允许匿名建立文件夹
anon_other_write_enable=YES //开启允许匿名其他用户写权限(慎用)
[root@jm vsftpd]# systemctl restart vsftpd //服务重启配置生效
[root@jm vsftpd]# chown ftp.ftp /var/ftp/pub/ //修改FTP共享目录的属主属组为 ftp
[root@jm vsftpd]# chmod 755 /var/ftp/pub/ //默认权限不建议改变
4、用户名密码方式访问FTP
[root@jm ~]# useradd -s /sbin/nologin edit_A //编辑用户A禁止登陆系统
[root@jm ~]# useradd -s /sbin/nologin edit_B //编辑用户B禁止登陆系统
[root@jm ~]# echo "123456" | passwd --stdin edit_A //设置edit_A的密码
[root@jm ~]# echo "123456" | passwd --stdin edit_B //设置edit_B的密码
[root@jm ~]# vim /etc/vsftpd/vsftpd.conf //编辑配置文件
anonymous_enable=NO //关闭匿名访问
local_enable=YES //允许本地用户登陆

101 local_root=/var/www/html //设置FTP的根目录
102 chroot_list_enable=YES //开启chroot
103 # (default follows)
104 chroot_list_file=/etc/vsftpd/chroot_list //设置被锁定用户的列表文件
105 allow_writeable_chroot=YES //允许锁定用户有写权限
[root@jm ~]# touch /etc/vsftpd/chroot_list //创建锁定用户列表文件
[root@jm ~]# vim /etc/vsftpd/chroot_list //编辑并加入用户列表

[root@jm ~]# ll -d /var/www/html/ //长格式查看目录本身权限(-d表示目录)
[root@jm ~]# chmod -R o+w /var/www/html/ //-R递归 赋予o(其他用户)+w(写)权限
⚠ 附加ssl加密传输
[root@jm ~]# openssl req -new -x509 -nodes -out vsftpd.pem -keyout vsftpd.pem -days 3560
//-------------------------------------------------------------
OpenSSL 简单参数解释:
req #是 X.509 Certificate Signing Request (CSR,证书签名请求)管理的一个命令。
x509 #X.509 证书数据管理。
days #定义证书的有效日期。
newkey #指定证书密钥处理器。
keyout #设置密钥存储文件。
out #设置证书存储文件,注意证书和密钥都保存在一个相同的文件
---------------------------------------------------------------//
[root@jm ~]# mkdir /etc/vsftpd/.sslkey //创建隐藏目录存放证书文件
[root@jm ~]# mv vsftpd.pem /etc/vsftpd/.sslkey //移动证书文件到.sslkey目录下
[root@jm ~]# chmod 400 /etc/vsftpd/.sslkey/vsftpd.pem //赋予证书文件400权限
[root@jm ~]# vim /etc/vsftpd/vsftpd.conf
//加入下列
118 # config ssl
119 ssl_enable=YES -------------//启用
120 allow_anon_ssl=NO ----------//允许匿名访问ssl=NO
121 force_local_data_ssl=YES
122 force_local_logins_ssl=YES
123 force_anon_logins_ssl=YES
124 force_anon_data_ssl=YES
//上面四行force 表示强制匿名用户使用加密登陆和数据传输
125 ssl_tlsv1=YES
126 ssl_sslv2=YES
127 ssl_sslv3=YES
128 require_ssl_reuse=NO //不重用SSL会话,安全配置项
129 ssl_ciphers=HIGH //允许用于加密 SSL 连接的 SSL 算法
130 rsa_cert_file=/etc/vsftpd/.sslkey/vsftpd.pem
131 rsa_private_key_file=/etc/vsftpd/.sslkey/vsftpd.pem
//定义 SSL 证书和密钥文件的位置
注意:上面的配置项不要添加到vsftpd.conf 文件最后,否则启动报错。
[root@jm ~]# systemctl restart vsftpd //重启 vsftp
- 测试
登陆测试:
1、[root@jm ~]# lftp 192.168.1.10 -u edit_A //登陆FTP
2、配置FileZilla客户端验证 https://filezilla-project.org/download.php?type=client
结束
Linux 之CentOS7-VSFTP搭建的更多相关文章
- linux下使用vsftp搭建FTP服务器:匿名登录,账号登录,SSL加密传输
目录 一.关于FTP和VSFTP 二.ftp.sftp.vsftp.vsftpd的区别 三.项目一:搭建一台所有人都可以访问的通用FTP服务器 3.1 项目要求 3.2 项目思路分析 3.3 使用vs ...
- Linux安装配置vsftp搭建FTP的详细配置
这里主要是说vsftp的配置:基础的可以参考Linux中VSFTP的配置 转自:https://www.jb51.net/article/103904.htm 修改配置文件 配置文件/etc/vsft ...
- linux系统centOS7下搭建redis集群中ruby版本过低问题的解决方法
问题描述: 在Centos7中,通过yum安装ruby的版本是2.0.0,但是如果有些应用需要高版本的ruby环境,比如2.2,2.3,2.4... 那就有点麻烦了,譬如:我准备使用redis官方给的 ...
- linux(centos7)下SVN服务器如何搭建
linux(centos)下SVN服务器如何搭建?说到SVN服务器,想必大家都知道,可以是在LINUX下如何搭建SVN服务器呢?那么今天给大家分享一下linux(centos)搭建SVN服务器的思路! ...
- Linux系统:Centos7环境搭建Redis单台和哨兵集群环境
本文源码:GitHub·点这里 || GitEE·点这里 一.环境和版本 Linux:centos7 三台 三台Linux服务 192.168.72.129 192.168.72.130 192.16 ...
- linux(centos7)下SVN服务器搭建
https://www.cnblogs.com/fuyuanming/p/6123395.html linux(centos)下SVN服务器如何搭建?说到SVN服务器,想必大家都知道,可以是在LINU ...
- Linux系统:Centos7下搭建PostgreSQL关系型数据库
本文源码:GitHub·点这里 || GitEE·点这里 一.PostgreSQL简介 1.数据库简介 PostgreSQL是一个功能强大的开源数据库系统,具有可靠性.稳定性.数据一致性等特点,且可以 ...
- Linux(Centos7) 实例搭建 FTP 服务
本文以 CentOS 7.2 64位系统为例,使用 vsftpd 作为 FTP 服务端,FileZilla 作为客户端.指导您如何在 Linux 云服务器上搭建 FTP 服务. 操作步骤 安装 vsf ...
- linux(centos7)下SVN服务器搭建手札
linux(centos)下SVN服务器如何搭建?说到SVN服务器,想必大家都知道,可以是在LINUX下如何搭建SVN服务器呢?那么今天给大家分享一下linux(centos)搭建SVN服务器的思路! ...
- 腾讯云服务器linux centOS7.4 搭建ftp服务器 vsftpd
腾讯云服务器linux centos 7.4 搭建ftp服务器 vsftpd 在centos 7.3测试也是OK的,其它版本没有实验 # 安装 vsftpd $ yum install vsftpd ...
随机推荐
- Nginx与PHP-FPM运行原理详解
目录 1. 代理与反向代理 1. 正向代理:访问google.com 2. 反向代理:通过反向代理实现负载均衡 2. 初识Nginx与PHP-FPM 1. Nginx是什么 2. CGI与FastCG ...
- angular4脚手架搭建
Angular4.X安装,创建 1.安装最新的nodejs(node -v ,npm -v) 2.新建文件夹(右键git bash here)npm install -g @angular/cli 3 ...
- git merge后如何撤销
merge后发现冲突太多,或者合并的分支代码并不是最新,那就直接撤销再合并好了. git reset --hard HEAD 用来撤销还没commit 的merge,其实原理就是放弃index和工作区 ...
- XMPP技术之Smack库的自定义消息扩展
写此文是为了纪念我耗时两天的Smack库应用开发. 太苦恼了,网上找了一堆材料,关于XMPP的消息扩展方面的资料感觉都是出于同一个源头,基本问题还是基于的库版本都是低于4.1版本的讲解. 我是在Sma ...
- python --(链表)
链表的使用 #/usr/bin/python#-*- coding: utf-8 -*-#Function: simulate the link-list in python#__author__: ...
- Cocos Creator 监听安卓屏幕下方返回键
addEscEvent = function(node){ cc.eventManager.addListener({ event: cc.EventListener.KEYBOARD, onKeyP ...
- 测试12.2.0.1RAC PDB级别的Failover
关键步骤:手工添加服务名A并启动(已验证默认的服务名测试验证无法实现Failover) [oracle@db90 ~]$ srvctl add service -db orcl -service A ...
- dubbo搭建
1.安装java : yum install java 2.下载Tomcat: wget http://mirrors.shu.edu.cn/apache/tomcat/tomcat-9/v9.0.1 ...
- Unity 让物体朝摄像机观察方向移动,已摇杆方向转向
using System.Collections;using System.Collections.Generic;using UnityEngine; [RequireComponent(typeo ...
- 【Access】数据库四门功课--[增删改查]基础篇
一.增 以userinfo为例 1.增加一条完整的数据 INSERT INTO userinfo VALUES (1, 2, 3, 4); 基本格式:INSERT INTO AAA VALUES (X ...