vsftpd安装使用-直接把配置文件替换进去

执行以下命令,安装 vsftpd。
yum install -y vsftpd

执行以下命令,设置 vsftpd 开机自启动。
systemctl enable vsftpd

执行以下命令,启动 FTP 服务。
systemctl start vsftpd

执行以下命令,重启 FTP 服务。
systemctl restart vsftpd

执行以下命令,确认服务是否启动。
netstat -antup | grep ftp
显示结果如下,则说明 FTP 服务已成功启动。

新建一个本地用户:名为admin

useradd admin

为admin用户设置密码:密码为123456aa
passwd 123456aa

进入vsftpd的配置文件,把里面的内容全部改成我的配置内容

vi /etc/vsftpd/vsftpd.conf

 

我的vsftpd.conf配置文件

# 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.
#
# 设定不允许匿名访问
anonymous_enable=NO
#
# 设定本地用户可以访问
local_enable=YES
#
#设定可以进行写操作
write_enable=YES
#
#设定上传后文件的权限掩码
local_umask=022
#
# 禁止匿名用户上传
anon_upload_enable=NO
#
# 禁止匿名用户建立目录
anon_mkdir_write_enable=NO
#
# 欢迎语设置
dirmessage_enable=NO
#
# 设定开启日志记录功能
xferlog_enable=NO
#
# 设定端口20进行数据连接(主动模式)
connect_from_port_20=YES
#
# 设置是否改变匿名用户上传文件(非目录)的属主。默认值为NO
chown_uploads=NO
#chown_username=whoever
#
# 设定Vsftpd的服务日志保存路径
#xferlog_file=/var/log/xferlog
#
# 设定日志使用标准的记录格式
xferlog_std_format=YES
#
# 设置多长时间不对FTP服务器进行任何操作,则断开该FTP连接,单位为秒
idle_session_timeout=1000
#
#PORT 方式下建立数据连接的超时时间,单位为秒
data_connection_timeout=1000
#
# 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
#
# 设定支持异步传输功能
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模式的上传和下载功能
ascii_download_enable=YES
#
# 设定Vsftpd的登陆标语
#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=NO
#
# 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=YES
#
# 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=NO

pam_service_name=vsftpd
userlist_enable=NO
tcp_wrappers=YES
#这个可以解决chroot权限问题
allow_writeable_chroot=YES

#请修改为您的 Linux 云服务器公网 IP,可以不填
pasv_address=139.198.xxx.xx

pasv_min_port=39000 
pasv_max_port=40000

注:开启39000-40000的端口   开启20 21 22的端口 改完配置文件的内容,要重启vsftpd服务

我是在云服务器上安装的,现在我可以直接 ftp:139.198.xxx.xx来访问了

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值