如何使用vsftpd纠正文件上传错误

时间:2018-12-03 04:38:57

标签: linux ftp centos vsftpd

我已经安装了Cent OS 7 Minimal 1804,并且我正在尝试安装vsftpd。安装有效,但是我有一个无法解决的上传权限问题。尝试上传文件时,出现错误553无法创建文件。我的设置对我来说看起来正确,权限也很好,所以我不确定问题出在哪里。

我的vsftp安装脚本:

#!/bin/sh
# /etc/vsftpd/vsftpd.conf
yum -y install vsftpd

cat > /etc/vsftpd/vsftpd.conf <<EOL
anonymous_enable=NO
local_enable=YES
write_enable=YES
local_umask=022
dirmessage_enable=YES
xferlog_enable=YES
connect_from_port_20=YES
#xferlog_file=/var/log/xferlog
xferlog_std_format=YES
#idle_session_timeout=600
#data_connection_timeout=120
#nopriv_user=ftpsecure
#async_abor_enable=YES
#ascii_upload_enable=YES
#ascii_download_enable=YES
#ftpd_banner=Welcome to blah FTP service.
#deny_email_enable=YES
#banned_email_file=/etc/vsftpd/banned_emails
chroot_local_user=YES
allow_writeable_chroot=YES
#chroot_list_enable=YES
#chroot_list_file=/etc/vsftpd/chroot_list
#ls_recurse_enable=YES
listen=NO
listen_ipv6=NO
pam_service_name=vsftpd
tcp_wrappers=YES
userlist_enable=YES
userlist_file=/etc/vsftpd.userlist
userlist_deny=YES
EOL

cat > /etc/vsftpd.userlist <<EOL
ftpuser
EOL

mkdir -p /var/ftpuser
groupadd ftpusers
useradd -d '/var/ftpuser' -s /sbin/nologin ftpuser
passwd ftpuser
usermod -G ftpusers ftpuser
chown -R ftpuser:ftpusers '/var/ftpuser'
chmod 777 '/var/ftpuser'

systemctl start vsftpd
systemctl enable vsftpd
firewall-cmd --zone=public --permanent --add-port=21/tcp
firewall-cmd --zone=public --permanent --add-service=ftp
firewall-cmd --reload

我的filezilla ftp命令日志试图上传文件:

Status: Connecting to 192.168.1.163:21...
Status: Connection established, waiting for welcome message...
Status: Logged in
Status: Starting upload of c:\temp\header.png
Command:    CWD /var/ftpuser
Response:   250 Directory successfully changed.
Command:    TYPE I
Response:   200 Switching to Binary mode.
Command:    PASV
Response:   227 Entering Passive Mode (192,168,1,163,230,180).
Command:    STOR header.png
Response:   553 Could not create file.
Error:  Critical file transfer error

我的Linux权限:

[root@id-sftp scripts]# ls -la /var/ftpuser
total 4
drwxrwxrwx.  2 ftpuser ftpusers    6 Dec  2 22:20 .
drwxr-xr-x. 23 root    root     4096 Dec  2 22:20 ..

0 个答案:

没有答案