Centos7搭建FTP服务
1、安装 vsftpd
[root@CentOS ftp]# yum -y install vsftpd
2、启动 vsftpd 服务
[root@CentOS ~]# systemctl start vsftpd.service # 启动 vsftpd 服务
[root@CentOS ~]# ps -ef | grep vsftpd # 查看 vsftpd 进程是否存在
root 3753 1 0 18:51 ? 00:00:00 /usr/sbin/vsftpd /etc/vsftpd/vsftpd.conf
root 3758 3494 0 18:51 pts/0 00:00:00 grep --color=auto vsftpd
[root@CentOS ~]#
3、开放 21 端口
[root@CentOS ~]# firewall-cmd --zone=public --add-port=21/tcp --permanent # 添加 21 端口
success
[root@CentOS ~]# firewall-cmd --reload # 重新载入
success
[root@CentOS ~]# firewall-cmd --zone=public --list-ports # 查看所有已开放的端口
21/tcp 3690/tcp 3306/tcp # 可以看到 21 端口已开放
[root@CentOS ~]#
4、使用FileZilla进行客户端测试
(1)首先,将传输模式设置为主动模式:
(2)然后测试匿名登录:
使用匿名用户登录成功后,默认的主目录为 /var/ftp ,可以看到在该目录中有一个pub目录。
[root@CentOS ~]# ls -l /var/ftp
总用量 0
drwxr-xr-x. 2 root root 6 8月 3 2017 pub # 确认pub目录已存在
[root@CentOS ~]#
5、配置 selinux
默认情况下,CentOS 的FTP 是不允许实体账号登录取得用户主目录数据的,这是因为 SELinux 的问题。
[root@CentOS ~]# getsebool -a | grep ftp # 查看有关 ftp 的 selinux 策略规则
ftpd_anon_write --> off
ftpd_connect_all_unreserved --> off
ftpd_connect_db --> off
ftpd_full_access --> off
ftpd_use_cifs --> off
ftpd_use_fusefs --> off
ftpd_use_nfs --> off
ftpd_use_passive_mode --> off
httpd_can_connect_ftp --> off
httpd_enable_ftp_server --> off
tftp_anon_write --> off
tftp_home_dir --> off
[root@CentOS ~]# setsebool -P tftp_home_dir=1 # 将 tftp_home_dir 规则设置为 1
6、建立 ftp 账户
新建一个不能登录系统,而只能登录 ftp 服务的用户。
[root@CentOS ~]# useradd ftpuser -s /sbin/nologin # 添加用户 ftpuser
[root@CentOS ~]# passwd ftpuser # 设置密码
7、配置 vsftpd.conf
# 禁止匿名用户登录
anonymous_enable=NO
# 配置与实体用户相关的信息,可写入
userlist_enable=YES
userlist_deny=NO
userlist_file=/etc/vsftpd/user_list
之所以配置以上信息项,是因为我想只让某些人可以使用 FTP,而直接添加的用户默认不可使用 FTP 这个服务。如果我们想查看更多有关这个文件的配置说明,可以通过 man 5 vsftpd.conf 命令进行查看。
8、将 ftpuser 用户添加到 /etc/vsftpd/user_list 文件中,编辑后的内容如下:
[root@CentOS ~]# cat /etc/vsftpd/user_list
# vsftpd userlist
# If userlist_deny=NO, only allow users in this file
# If userlist_deny=YES (default), never allow users in this file, and
# do not even prompt for a password.
# Note that the default vsftpd pam config also checks /etc/vsftpd/ftpusers
# for users that are denied.
#root
#bin
#daemon
#adm
#lp
#sync
#shutdown
#halt
#mail
#news
#uucp
#operator
#games
#nobody
ftpuser # 指定只有 ftpuser 用户可以使用 FTP 服务,其他用户不能使用(已注释的用户)
[root@CentOS ~]#
此时写入 /etc/vsftpd/user_list 的用户就是可以使用 FTP 的账号了。所以未来添加的用户如果想使用 FTP 的话,也必须要写入这个文件。
9、重启 vsftpd 服务
[root@CentOS ~]# systemctl restart vsftpd.service
[root@CentOS ~]# ps -ef | grep vsftpd
root 4568 1 0 19:51 ? 00:00:00 /usr/sbin/vsftpd /etc/vsftpd/vsftpd.conf
root 4573 3494 0 19:51 pts/0 00:00:00 grep --color=auto vsftpd
[root@CentOS ~]#
10、再次使用 FileZilla 进行测试
如上所示,用户 ftpuser 已登录成功,默认的用户主目录为 /home/ftpuser。
11、将 vsftpd 服务设置为开机启动
[root@CentOS ~]# systemctl enable vsftpd.service
Created symlink from /etc/systemd/system/multi-user.target.wants/vsftpd.service to /usr/lib/systemd/system/vsftpd.service.
[root@CentOS ~]#
Centos7搭建FTP服务的更多相关文章
- Centos7搭建FTP服务详细过程
Centos7搭建FTP服务详细过程https://blog.csdn.net/sinat_30802291/article/details/81706152
- Centos7 搭建FTP服务
安装vsftpd yum install -y vsftpd 修改配置文件 cd /etc/vsftpd user_list # 白名单 ftpusers # 黑名单 vsftpd.conf # 配置 ...
- centos7中搭建ftp服务
博客搬家: centos7中搭建ftp服务 最近想和同学共享一些文件资源,于是在实验室服务器上搭建个ftp服务,本博客记录一下配置的流程.过程基本是参照别人的方法来做的,博客也是在别人博客基础上修改的 ...
- Linux(Centos7) 实例搭建 FTP 服务
本文以 CentOS 7.2 64位系统为例,使用 vsftpd 作为 FTP 服务端,FileZilla 作为客户端.指导您如何在 Linux 云服务器上搭建 FTP 服务. 操作步骤 安装 vsf ...
- 在Win7的IIS上搭建FTP服务及用户授权
FTP服务 FTP是文件传输协议(File Transfer Protocol)的简称,该协议属于应用层协议(端口号通常为21),用于Internet上的双向文件传输(即文件的上传和下载).在网络上有 ...
- 在Win7的IIS上搭建FTP服务及用户授权——转载!!
原文地址:http://blog.sina.com.cn/s/blog_6cccb1630100q0qg.html FTP服务 FTP是文件传输协议(File Transfer Protocol)的简 ...
- 【阿里云】在 Windows Server 2016 下使用 FileZilla Server 安装搭建 FTP 服务
Windows Server 2016 下使用 FileZilla Server 安装搭建 FTP 服务 一.安装 Filezilla Server 下载最新版本的 Filezilla Server ...
- 【转】在Win7的IIS上搭建FTP服务及用户授权
[转]在Win7的IIS上搭建FTP服务及用户授权 [转]在Win7的IIS上搭建FTP服务及用户授权 FTP服务 FTP是文件传输协议(File Transfer Protocol)的简称,该协议属 ...
- FTP相关、用vsftpd搭建ftp、xshell使用xftp传输文件、使用pure-ftpd搭建ftp服务
1.FTP相关(file transfer protocol,文件传输协议) 2.用vsftpd搭建ftp安装:yum install vsftpd -y创建一个虚拟用户:useradd vft ...
随机推荐
- 不错的图表库:ChartDirector
官网:http://www.advsofteng.com 1)for c++ 2)for .NET 3)for Java 4)for ASP/COM/VB 5)for PHP 6)for Python ...
- Apicloud_(项目)网上书城03_拓展模块实现
Apicloud_(项目)网上书城01_前端页面开发 传送门 Apicloud_(项目)网上书城02_后端数据获取 传送门 Apicloud_(项目)网上书城03_拓展模块实现 传送门 实现商品详情页 ...
- sqli-labs(43)
0X01和42关比起来 只是闭合变了 那么我们可以构造 ');insert into users values(98,'zhong','zhong')# 成功注入
- 「POI 2010」Bridges
题目链接 戳我 \(Solution\) 看到"最大值最小",就知道应该要二分 二分之后,对于每个\(mid\),只要计算小于\(mid\)的边,然后在剩下的图中判断有无欧拉回路 ...
- JMH基准测试框架
jmh-gradle-plugin, 集成JMH基准测试框架和 Gradle 0 赞 0 评论 文章标签:Gradle JMH 基准 INT benchmark framework 帧 ...
- Golang协程实现流量统计系统(2)
从进程开始,搜索和理解进程 Google 搜索关键词: C fork example 什么是fork Fork系统调用用于创建一个称为子进程的新进程,该子进程与进行fork()调用的进程(父进程)同时 ...
- LeetCode 2. 两数相加(Add Two Numbers)
题目描述 给定两个非空链表来表示两个非负整数.位数按照逆序方式存储,它们的每个节点只存储单个数字.将两数相加返回一个新的链表. 你可以假设除了数字 0 之外,这两个数字都不会以零开头. 示例: 输入: ...
- MySQL 建表时 date 类型的默认值设置
在执行下面 SQL 语句时发现报错 CREATE TABLE `jc_site_access_pages` ( `access_date` date NOT NULL DEFAULT '0000-00 ...
- opengl入门篇二: 索引缓冲对象EBO
在绘制图形的过程中,顶点可能会重复.比如两个三角形组成了四边形,那么,必然有两个点是重复的.因此采用索引的方式,四个点即可描述四边形. // 四个顶点 GLfloat vertices[] = { / ...
- KVM + LinuxBridge 的网络虚拟化解决方案实践
目录 文章目录 目录 前言 Linux bridge 的基本操作 创建 Bridge 将 veth pair 连上 Bridge 为 Bridge 配置 IP 地址 将物理网卡接口设备挂靠 Bridg ...