首页 技术 正文
技术 2022年11月21日
0 收藏 301 点赞 4,035 浏览 2619 个字

内容简介:

  • vsftpd的安装

  • 目录介绍

  • 配置参数解释

  • 锁定用户目录

  • 其他用户不能登录

———————————————————————————————-

1、安装vsftpd

安装

yum install vsftpd   

配置文件目录

cd /etc/vsftpd

启动、停止、重启

systemctl start vsftpdsystemctl stop vsftpdsystemctl restart vsftpd

2、目录介绍

Linux之FTP篇

vsftpd.conf  ftp的核心配置文件

ftpusers   禁止登录FTP的用户列表

chroot_list  是否允许用户列表内的用户访问父目录

user_list   是否允许列表内的用户登录

以上将在下个部分讲解

3、配置文件详解

https://www.cnblogs.com/rainiplus/p/3739100.html,,人家写的比我好多了23333

 # Allow anonymous FTP?
anonymous_enable=NO # allow local users to log in.
local_enable=YES # 允许写操作
write_enable=YES # Default umask for local users is . You may wish to change this to ,
# if your users expect that ( is used by most other ftpd's)
local_umask= allow_ftpd_full_access # 匿名是否允许上传文件
#anon_upload_enable=YES # 匿名是否允许写操作
#anon_mkdir_write_enable=YES # 欢迎语设置,如果有.message这个文件
# 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 (ftp-data).
# 主动模式时使用20端口连接客户端
connect_from_port_20=YES # 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.
# FTP入职格式化
xferlog_std_format=YES # You may change the default value for timing out an idle session.
# 一段时间没有操作后断开连接
#idle_session_timeout= # You may change the default value for timing out a data connection.
# FTP数据传输最大时间,超过则断开连接
#data_connection_timeout= # 是否使用ASCII码传输,默认使用二进制
#ascii_upload_enable=YES
#ascii_download_enable=YES # 是否允许用户访问父目录,默认YES
chroot_local_user=NO
# 文件限制是否开启,若开启后,则列表中的用户无法访问父目录
chroot_list_enable=YES
chroot_list_file=/etc/vsftpd/chroot_list
#iginre the writeable check
# 忽略写权限检查,如果chroot_local_user=NO,那么主目录不能有写权限,这里忽略掉它
allow_writeable_chroot=YES # 是否允许列表用户登录
# 开启文件检查
#userlist_enable=YES
# 文件列表中的用户是否进制登录,YES:禁止登录
#userlist_deny=YES
#userlist_file=/etc/vsftpd/userlist # 监听IPV4
listen=YES
# 开启IPV4就关闭IPV6,好多还是用的IPV4
#listen_ipv6=YES # 应该与虚拟用户相关吧,不清楚
pam_service_name=vsftpd
# 是否允许主机连接。放这吧,不清楚
tcp_wrappers=YES # 开启被动模式,windows默认开启被动
pasv_enable=YES
# 端口开放,需要防火墙支持,如果时阿里云则需要开放端口入方向规则
pasv_min_port=
pasv_max_port=
# 暴漏给客户端外网IP,不设置默认暴漏原始IP,即内网加端口这种形式
pasv_address=你的外网ip

4、锁定用户主目录

chroot_list中放置要锁定的用户名,一行一个

Linux之FTP篇

修改配置

# 不允许列表中的用户访问父目录
chroot_local_user=NO
# 文件限制是否开启,若开启后,则列表中的用户无法访问父目录
chroot_list_enable=YES
chroot_list_file=/etc/vsftpd/chroot_list
#iginre the writeable check
# 忽略写权限检查,如果chroot_local_user=NO,那么主目录不能有写权限,这里忽略掉它
allow_writeable_chroot=YES

重启即可

5、禁止登陆

方案一:在ftpusers中添加,一行一个

方案二:使用user_list

在user_list中添加禁止登陆的用户,一行一个

Linux之FTP篇

修改配置文件

# 是否允许列表用户登录
# 开启文件检查
#userlist_enable=YES
# 文件列表中的用户是否进制登录,YES:禁止登录
#userlist_deny=YES
#userlist_file=/etc/vsftpd/userlist

重启即可

附录:FTP主动和被动区别

Linux之FTP篇

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,487
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,903
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,736
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,487
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:8,127
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:5,289