linux 安装FTP

news2024/9/22 2:03:40

检查是否已经安装

$] rpm -qa |grep vsftpd
vsftpd-3.0.2-29.el7_9.x86_64

出现 vsftpd 信息表示已经安装,无需再次安装

yum安装

$] yum -y install vsftpd

此命令需要root执行或有sudo权限的账号执行

在这里插入图片描述

/etc/vsftpd 目录

ftpusers # 禁用账号列表
user_list # 账号列表,其通过 conf 中 userlist_deny 控制
vsftpd.conf # 主配置文件

userlist_enable 默认为 YES,表示启用 user_list 文件。

userlist_deny 默认为 YES,表示禁止 user_list中的用户访问,userlist_deny 为 NO 表示 user_list 为白名单,允许 user_list 中的用户访问

禁用匿名登录

anonymous_enable=NO

此值默认为 YES。

启用本地登录

local_enable=YES

可以使用本地账号密码登录,登录后默认在对应用户的 home 目录。要修改可通过 local_root 设置,比如:

local_root=/opt/soft/es

注:如果设置 local_root 目录,则登录的用户需要有此文件夹的访问权限以及操作权限

启动与停止服务

# 启动
systemctl start vsftpd.service
# 停止
systemctl stop vsftpd.service

# 查看允许状态
systemctl status vsftpd.service

# 设置开机启动
systemctl enable vsftpd.service
systemctl disable vsftpd.service

# 重启
systemctl restart vsftpd.service

完整的示例配置如下:

# Example config file /etc/vsftpd/vsftpd.conf
#
# The default compiled in settings are fairly paranoid. This sample file
# loosens things up a bit, to make the ftp daemon more usable.
# Please see vsftpd.conf.5 for all compiled in defaults.
#
# READ THIS: This example file is NOT an exhaustive list of vsftpd options.
# Please read the vsftpd.conf.5 manual page to get a full idea of vsftpd's
# capabilities.
#
# Allow anonymous FTP? (Beware - allowed by default if you comment this out).
anonymous_enable=NO
#
# Uncomment this to allow local users to log in.
# When SELinux is enforcing check for SE bool ftp_home_dir
local_enable=YES
local_root=/opt/soft/es
#
# 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.
# When SELinux is enforcing check for SE bool allow_ftpd_anon_write, allow_ftpd_full_access
#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
#
# Activate logging of uploads/downloads.
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
#
# You may override where the log file goes if you like. The default is shown
# below.
#xferlog_file=/var/log/xferlog
#
# If you want, you can have your log file in standard ftpd xferlog format.
# Note that the default log file location is /var/log/xferlog in this case.
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. The vsftpd.conf(5) man page explains
# the behaviour when these options are disabled.
# 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().
# (Warning! chroot'ing can be very dangerous. If using chroot, make sure that
# the user does not have write access to the top level directory within the
# 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=NO
#
# This directive enables listening on IPv6 sockets. By default, listening
# on the IPv6 "any" address (::) will accept connections from both IPv6
# and IPv4 clients. It is not necessary to listen on *both* IPv4 and IPv6
# sockets. If you want that (perhaps because you want to listen on specific
# addresses) then 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
userlist_deny=NO

启动后通过相应的客户端登录访问即可。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/819173.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

【Ajax】笔记-设置CORS响应头实现跨域

CORS CORS CORS是什么? CORS(Cross-Origin Resource Sharing),跨域资源共享。CORS是官方的跨域解决方案,它的特点是不需要在客户端做任何特殊的操作,完全在服务器中进行处理,支持get和post请求。跨域资源共享标准新增了一组HTTP首…

VSCode格式化shell脚本

安装格式化插件:shell-format 用VSCode打开shell脚本之后,按格式化快捷键CtrlAltF,会提示没有格式化shell的工具,然后安装插件,我装的是这个插件:shell-format。 介绍:https://marketplace.vis…

2.C语言数据类型

常量与变量 1.**常量:**程序运行中,值不改变的量 变量:int num5;值可以变的量 2 C语言三种简单数据类型:整型,实型,字符型 %c %d %ld %s %f整型-进制的转换 **1.十进制:**默认的进…

SpringBoot使用JKS或PKCS12证书实现https

SpringBoot使用JKS或PKCS12证书实现https 生成JKS类型的证书 可以利用jdk自带的keytool工具来生成证书文件, 默认生成的是JKS证书 cmd命令如下: 执行如下命令,并按提示填写证书内容,最后会生成server.keystore文件 keytool -genkey tomcat…

ChatGPT在商业世界中的创新应用:颠覆传统营销与客户关系管理

🌷🍁 博主 libin9iOak带您 Go to New World.✨🍁 🦄 个人主页——libin9iOak的博客🎐 🐳 《面试题大全》 文章图文并茂🦕生动形象🦖简单易学!欢迎大家来踩踩~&#x1f33…

14、容器初始化器和配置环境后处理器

容器初始化器和配置环境后处理器 容器初始化器 与传统Spring的容器后处理器(也可对容器做一些定制)对比,此处的容器初始化器的执行时机要更早一些。 容器初始化器负责可对Spring容器执行初始化定制。 就是在启动项目的时候,在容…

eclipse版本与jdk版本对应关系

官网:Eclipse/Installation - Eclipsepedia eclipse历史版本(2007-):Older Versions Of Eclipse - Eclipsepedia Eclipse Packaging Project (EPP) Releases | Eclipse Packages

springboot疾病查询网站【纯干货分享,免费领源码01548】

spring boot疾病查询网站 摘 要 随着互联网时代的到来,同时计算机网络技术高速发展,网络管理运用也变得越来越广泛。因此,建立一个B/S结构的疾病查询网站,会使疾病查询工作系统化、规范化,也会提高医院形象&#xff0c…

红外雨量计(光学雨量传感器)检测降雨量,预防内涝

红外雨量计(光学雨量传感器)检测降雨量,预防内涝 随着城市化进程的加快,城市内涝成为一个愈发严峻的问题。短时间内大量的降雨,不仅会给城市交通带来困难,也会对城市的基础设施和居民的生活造成很大的影响…

ESP32cam系列教程003:ESP32cam实现远程 HTTP_OTA 自动升级

文章目录 1.什么是 OTA2. ESP32cam HTTP_OTA 本地准备2.1 HTTP OTA 升级原理2.2 开发板本地基准程序(程序版本:1_0_0)2.3 开发板升级程序(程序版本:1_0_1)2.4 本地 HTTP_OTA 升级测试2.4.1 本地运行一个 HT…

Spring系列二:基于注解配置bean

文章目录 💗通过注解配置bean🍝基本介绍🍝快速入门🍝注意事项和细节 💗自己实现Spring注解配置Bean机制🍝需求说明🍝思路分析🍝注意事项和细节 💗自动装配 Autowired&…

谷粒商城第八天-商品服务之品牌管理的整体实现(直接使用逆向生成的代码;含oss文件上传)

目录 一、总述 二、前端部分 2.1 创建好品牌管理菜单 2.2 复制组件 ​编辑2.3 复制api ​​​编辑 2.4 查看效果 ​编辑2.5 需要优化的地方 2.6 具体优化实现 2.6.1 优化一:将表格的状态列(这里是是否显示列)修改为开关&#xff…

Day15-作业(Maven高级)

作业1:完成苍穹外卖项目目录结构创建 说明: 1.sky-take-out 是父工程 2.sky-common/sky-pojo/sky-server 是子工程 3.sky-server模块引用了sky-common/sky-pojo模块 作业2:完成汇客CRM项目目录结构创建 说明: huike-paren…

判断变量是否为标量(没有维度,单个数值)numpy.isscalar()

【小白从小学Python、C、Java】 【计算机等级考试500强双证书】 【Python-数据分析】 判断变量是否为标量 (没有维度,单个数值) numpy.isscalar() [太阳]选择题 请问关于以下代码表述错误的是? import numpy as np a 0 b np.array([0]) pri…

六、初始化和清理(3)

本章概要 成员初始化构造器初始化 初始化的顺序静态数据的初始化显式的静态初始化非静态实例初始化 成员初始化 Java 尽量保证所有变量在使用前都能得到恰当的初始化。对于方法的局部变量,这种保证会以编译时错误的方式呈现,所以如果写成&#xff1a…

初识Java - 概念与准备

本笔记参考自: 《On Java 中文版》 目录 写在第一行 Java的迭代与发展 Java的迭代 Java的参考文档 对象的概念 抽象 接口 访问权限 复用实现 继承 基类和子类 A是B和A像B 多态 单根层次结构 集合 参数化类型 对象的创建和生命周期 写在第一行 作为一…

Charles抓包工具使用(一)(macOS)

Fiddler抓包 | 竟然有这些骚操作,太神奇了? Fiddler响应拦截数据篡改,实现特殊场景深度测试(一) 利用Fiddler抓包调试工具,实现mock数据特殊场景深度测试(二) 利用Fiddler抓包调试工…

pytorch-gpu 极简安装

1、进入pytoch官网:PyTorch 找到pytorch-gpu版本,看到CUDA11.8、11.7、CPU,这里我选择安装CUDA11.8 2、下载CUDA Toolkit:CUDA Toolkit 11.8 Downloads | NVIDIA Developer 3、下载CUDANN:cuDNN Download | NVIDIA D…

TCP拥塞控制详解 | 1. 概述

网络传输问题本质上是对网络资源的共享和复用问题,因此拥塞控制是网络工程领域的核心问题之一,并且随着互联网和数据中心流量的爆炸式增长,相关算法和机制出现了很多创新,本系列是免费电子书《TCP Congestion Control: A Systems …

基于Spring Boot的鲜花销售网站设计与实现(Java+spring boot+MySQL)

获取源码或者论文请私信博主 演示视频: 基于Spring Boot的鲜花销售网站设计与实现(Javaspring bootMySQL) 使用技术: 前端:html css javascript jQuery ajax thymeleaf 微信小程序 后端:Java springboot…