LInux基础——vsftpd问题

1、问题:客户端报错“响应: 500 OOPS: failed to open xferlog log file:/var/log/vsftpd/vsftpd.conf”

根因:没有创建vsftpd日志目录

# 创建vsftpd日志目录
mkdir /var/log/vsftpd

 2、问题:修改默认vsftpd登入端口

根因:/etc/vsftpd/vsftpd.conf

# 将默认登入端口21修改未13241
# 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 listen_port=13241 # # 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

3、启用被动模式

# Make sure PORT transfer connections originate from port 20 (ftp-data).
# 关闭主动模式 #connect_from_port_20
=YES
# 启动被动模式 pasv_enable
=YES pasv_min_port=55000 pasv_max_port=56000

6、允许上传和删除vsftpd服务器目录中的文件

 根因:由于/etc/vsftpd/vsftpd.conf中开启write_enable=NO禁止上传和删除;

vim /etc/vsftpd/vsftpd.conf
    write_enable=YES
systemctl daemon-reload
systemctl restart vsftpd

7、限制ftp用户登入到主目录

 根因:由于chroot_local_user=YES开启限制所有用户只能登入主目录,主目录没有写权限,需要配置allow_writeable_chroot=YES开启读写权限;

# 开启当前ftp用户读写权限
allow_writeable_chroot=YES

 8、开启ftp登入用户上传、删除所用目录及文件权限

# 通过启用chroot_list白名单添加对应用户root,可以管理系统所有目录及文件
chroot_list_enable=YES chroot_list_file=/etc/vsftpd/chroot_list

 9、开启ftp用户登入到指定根目录/opt

# 登入到/opt根目录
local_root=/opt

参考

https://www.cnblogs.com/jipinglong/p/11230851.html
https://www.cnblogs.com/tdsj/p/15693476.html
https://www.cnblogs.com/halberd-lee/p/11734363.html
https://www.cnblogs.com/linuxMA/p/11526928.html

 

posted on 2024-12-16 17:13  gkhost  阅读(132)  评论(0)    收藏  举报

导航