首页 > 其他分享 >vsftpd安装

vsftpd安装

时间:2023-06-01 13:34:23浏览次数:42  
标签:enable ssl etc vsftpd user YES 安装

 

注意事项:FTPS数据存取介质磁盘不能为lvm格式,且不能挂载到lvm的目录下


1、yum  -y  install   ftp  vsftpd

vsftpd: version 3.0.2

    mkdir -p /etc/vsftpd/vsftpd_user_conf

2、编辑vsftpd的主配置文件(centos6和centos7的主配置文件vsftpd.conf不一样,其余的配置步骤一样

Centos6版本:

   vim   /etc/vsftpd/vsftpd.conf 

anonymous_enable=NO         //不允许匿名用户登录

   guest_enable=YES                  //允许虚拟用户登录

   guest_username=virtual         //虚拟用户名称

   pam_service_name=vsftpd    //pam认证文件名称

   user_config_dir=/etc/vsftpd/vsftpd_user_conf      //ftp虚拟用户的配置文件所在目录

   local_enable=YES

   write_enable=YES

   local_umask=022

   xferlog_enable=YES

   chroot_local_user=YES

   chroot_list_file=/etc/vsftpd/vsftpd_chroot_list

   pam_service_name=vsftpd

   userlist_enable=YES

   tcp_wrappers=YES

   log_ftp_protocol=YES

Centos7版本:    

 anonymous_enable=NO
原来是listen=NO,需改成YES) 
   pam_service_name=vsftpd
   userlist_enable=YES
   tcp_wrappers=YES
   guest_enable=YES
   guest_username=virtual
   user_config_dir=/etc/vsftpd/vsftpd_user_conf
centos7必须加入此配置)

原来是 listen_ipv6=YES,需改成NO)

   chroot_local_user=YES (新增,用户所在目录为根目录)

 

ftps安装:

vim   /etc/vsftpd/vsftpd.conf

anonymous_enable=NO

local_enable=YES
write_enable=YES
local_umask=022
dirmessage_enable=YES
connect_from_port_20=YES
xferlog_enable=YES
xferlog_std_format=YES
xferlog_file=/var/log/xferlog.log
dual_log_enable=YES
vsftpd_log_file=/var/log/vsftpd.log
listen_ipv6=NO

pam_service_name=vsftpd

#设置PAM使用的名称,默认值为/etc/pam.d/vsftpd
userlist_enable=YES
#限制userlist里面的本地用户不能访问
tcp_wrappers=YES
#设置为YES,则tcp wrapper相结合来进行主机的访问控制,vsftpd服务器会检查/etc/hosts.allow 和/etc/hosts.deny
guest_enable=YES
#启用虚拟用户
guest_username=virtual
#映射虚拟用户
user_config_dir=/etc/vsftpd/vsftpd_user_conf
#定义用户配置文件的目录
allow_writeable_chroot=YES
#如果某用户被限制在其家目录下,那么该用户的家目录不能再具有写权限,否则会报错。vsftpd-3.0(Centos7)才具有这种特性,

#启用SSL

ssl_enable=YES
ssl_tlsv1=YES
ssl_sslv2=NO
ssl_sslv3=NO
allow_anon_ssl=NO

#强制使用ssl(YES)

force_local_logins_ssl=YES
force_local_data_ssl=YES

force_anon_data_ssl=YES

force_anon_logins_ssl=YES

rsa_cert_file=/etc/ssl/private/vsftpd.pem

#key
require_ssl_reuse=NO
#设置为YES时,所有SSL数据连接都需要显示SSL会话重用(取决于客户端)
ssl_ciphers=HIGH
#加密方法

#以下选项同步自原FTP

#
chroot_local_user=YES
#限制用户只能在自己家目录
max_per_ip=12000
#每个ip的最大client数目
max_clients=12000
#可接受的最大client数目
virtual_use_local_privs=YES
#当该参数激活(YES)时,虚拟用户使用与本地用户相同的权限。
pasv_min_port=30000 #pasv连接模式时可以使用port 范围
pasv_max_port=45000 #pasv连接模式时可以使用port 范围

reverse_lookup_enable=no

 

 

3、编辑pam认证文件,新增如下两行,其余的都注释掉。

   vim   /etc/pam.d/vsftpd

 auth required pam_userdb.so db=/etc/vsftpd/vsftpd_login

   account required pam_userdb.so db=/etc/vsftpd/vsftpd_login

 

4、创建证书文件

mkdir -p /etc/ssl/private/

vim /etc/ssl/private/vsftpd.pem

-----BEGIN PRIVATE KEY-----
MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBALFhuSt6UmT2GLRgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBALFhuSt6UmT2GLRgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBALFhuSt6UmT2GLRgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBALFhuSt6UmT2GLRgkqhkiG9w0BAQEFAASCAmEwggJdAg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Tndxz80gZs/6
-----END CERTIFICATE-----

5、编辑ftp账户密码文件,生成db文件

/etc/vsftpd/

   vim  ftpuser.txt

 test

 test

  创建好账号密码后执行以下命令:

   db_load  -T  -t  hash  -f    ftpuser.txt   vsftpd_login.db     //生成db文件

6、编辑ftp用户配置文件

   vim  /etc/vsftpd/vsftpd_user_conf/test

 anon_world_readable_only=NO

   write_enable=YES

   anon_upload_enable=YES

   anon_mkdir_write_enable=YES

   anon_other_write_enable=YES

   local_root=/home/anfutong/Data/ftpdata/test/

 

注意:/etc/vsftpd/vsftpd_user_conf目录下的用户配置文件名称必须与用户名称一致。

 

 

创建虚拟用户:

useradd virtual -s /bin/false

 

6、创建ftp用户的家目录,配置权限

    mkdir  -p  /home/anfutong/Data/ftpdata/test

    chown    virtual.virtual   /home/anfutong/Data/ftpdata/test

7、启动服务

systemctl restart vsftpd


 

1

# 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
#
# 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
guest_enable=YES
guest_username=virtual
user_config_dir=/etc/vsftpd/vsftpd_user_conf
allow_writeable_chroot=YES

userlist_enable=YES
tcp_wrappers=YES
log_ftp_protocol=YES
anon_max_rate=31457280
local_max_rate=31457280

#ssl_enable=YES

allow_anon_ssl=NO

ssl_enable=yes
ssl_sslv2=yes
ssl_sslv3=yes
ssl_tlsv1=yes
#no:ftp和stps都可登录,yes:只能使用ftps登录
####定义登录强制ssl,数据传输ssl
force_local_data_ssl=NO
force_local_logins_ssl=NO
force_anon_logins_ssl=NO
force_anon_data_ssl=NO

require_ssl_reuse=NO
ssl_ciphers=HIGH
rsa_cert_file=/etc/pki/tls/certs/vsftpd.pem

12

 

ftp主动模式:
在/etc/vsftpd/vsftpd.conf中
将connect_from_port_20=YES换成connect_from_port_20=yes;
大小写的问题,不敢相信。。。

 

标签:enable,ssl,etc,vsftpd,user,YES,安装
From: https://blog.51cto.com/lenglingx/6393388

相关文章

  • 部署Ambari2.7.5 + HDP3.1.5安装
     java安装1.java解压安装cd/opttar-zxvfjdk1.8.0_181.tar.gz2.编辑环境变量配置vim/etc/profileexportJAVA_HOME=/opt/jdk1.8.0_231exportPATH=$JAVA_HOME/bin:$PATHexportCLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar3.生效环境变量配置sourc......
  • 在debian 11上新安装postgresql 13
    1、安装sudoaptinstallpostgresql-all2、建立用户sudosu-postgres,可以免密登录数据库createusermyuserwithpassword'111'CREATEDB;用新用户登录,不出意外应该会报PeerauthenticationfailedforuserXXX,原因是因为/etc/postgresql/13/main/pg_hba.conf中的locala......
  • hbase-2.2.3集群安装1
    安装程序,解压拷贝先设定hbase安装目录/home/opt/hbase-2.2.3tar-xvzfhbase-2.2.3.tar.gzmvhbase-2.3.3/home/opt配置环境变量vim/etc/profile添加如下exportHBASE_HOME=/home/opt/hbase-2.2.3exportPATH=$PATH:$HBASE_HOME/binsource/etc/profile 创建hbase的pids......
  • vsftpd日志配置及查看——可以将vsftpd记录在系统日志里
    vsftpd日志配置及查看vsftpdftp服务器的日志设置,可以通过修改主配置文件/etc/vsftpd.conf实现。主配置文件中与日志设置有关的选项包括xferlog_enable、xferlog_file和dual_log_enable等。 xferlog_enable 如果启用该选项,系统将会维护记录服务器上传和下载情况的日志文件。默......
  • MacOS无法安装cursor以及其他类似的zip包解压后软件
    1解压后,是一个文件夹   2改成app后缀的文件后,也是一样无法安装 3后面才发现,是自己安装的RAR解压软件有问题, 4选择系统自带的ArchiveUtility.app解压后就可以了  ......
  • UE4的下载和安装(UE4开发环境的搭建)
    使用UE4开发游戏之前,必须先搭建开发环境,具体包括:UE4引擎的下载和安装VisualStudio下载和安装UE4的下载和安装1)首先,打开任意一个浏览器输入UE4官方网站的网址 https://www.unrealengine.com/zh-CN/,点击右上角的“下载”按钮,如下图所示:2)官方要求必须登录......
  • mac docker 安装 kali linux
    先解决dockerpull慢的问题:解决dockerpull速度慢问题将docker镜像源修改为国内的:在 /etc/docker/daemon.json文件中添加以下参数(没有该文件则新建):mac{"registry-mirrors":["https://9cpn8tt6.mirror.aliyuncs.com"]}服务重启!记得是在docker的UIpreferrence里设置,然后重启......
  • Skywalking+Elasticsearch安装及应用(邮箱告警)
    1、Skywalking概述Skywalking是一个可观测性分析平台和应用性能管理系统,它也是基于OpenTracing规范、开源的AMP系统。Skywalking提供分布式跟踪、服务网格遥测分析、度量聚合和可视化一体化解决方案。SkyWalking特点:1)多语言自动探针2)为多种......
  • python--PythonMagick安装过程
    一、发现问题使用:pipinstallpythonmagick安装出错:1.打开网站下载自己python版本对应的pythonmagick版本其中的cp310,cp39之类就是对应Python的版本,不知道的也可以使用pipdebug--verbose查看2.打开CMD窗口,进入到pythonmagick的安装目录3.使用import命令将jpg、png图......
  • 基于CentOS7系统Docker19.03.15离线安装
    一、离线安装(1)去官网下载docker安装二进制包,选择适合自己的版本。这里下载的是docker-19.03.15.tgz,下载地址:https://download.docker.com/linux/static/stable/x86_64/(2)将安装包上传至安装机器(3)解压tar-xfdocker-19.03.15.tgz(4)将解压后的文件移至/usr/bin/......