vsftpd 服务未启动,提示 vsftpd.service: 主进程已退出,代码=已退出,状态=2/INVALIDARGUMENT

vsftpd 服务未启动,提示 vsftpd.service: 主进程已退出,代码=已退出,状态=2/INVALIDARGUMENT

我正在使用 Ansible 配置运行 Ubuntu 的虚拟机来运行此 FTP 服务器:vsftpd,但是安装后,当我检查日志时,journalctl -u vsftpd.service我看到:

Nov 20 17:49:58 my-vm systemd[1]: Starting vsftpd FTP server...
Nov 20 17:49:58 my-vm systemd[1]: Started vsftpd FTP server.
Nov 20 17:50:06 my-vm systemd[1]: Stopping vsftpd FTP server...
Nov 20 17:50:06 my-vm systemd[1]: Stopped vsftpd FTP server.
Nov 20 17:50:06 my-vm systemd[1]: Starting vsftpd FTP server...
Nov 20 17:50:06 my-vm systemd[1]: Started vsftpd FTP server.
Nov 20 17:50:06 my-vm systemd[1]: vsftpd.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
Nov 20 17:50:06 my-vm systemd[1]: vsftpd.service: Failed with result 'exit-code'.

我不确定我设置的配置有什么问题/etc/vsftpd.conf,如下:

anonymous_enable=NO        # disable anonymous login
local_enable=YES           # permit local logins
write_enable=YES           # enable FTP commands which change the filesystem
local_umask=022            # value of umask for file creation for local users
dirmessage_enable=YES      # enable showing of messages when users first enter a new directory
xferlog_enable=YES         # a log file will be maintained detailing uploads and downloads
connect_from_port_20=YES   # use port 20 (ftp-data) on the server machine for PORT style connections
xferlog_std_format=YES     # keep standard log file format
listen=NO                  # prevent vsftpd from running in standalone mode
listen_ipv6=YES            # THIS DOES NOT FIX THE FOLLWING: 'journalctl -u vsftpd.service' gives: 'vsftpd.service: Main process exited, code=exited, status=2/INVALIDARGUMENT'
pam_service_name=vsftpd    # name of the PAM service vsftpd will use
userlist_enable=YES        # enable vsftpd to load a list of usernames
tcp_wrappers=YES           # turn on tcp wrappers
ls_recurse_enable=YES      # allow to recursively inspect the file system (no problem with heavy I/O)
chroot_local_user=YES      # local users limited to their home directories after login (chroot jail)
allow_writeable_chroot=YES # allow chroot jail for local users to be writable
pasv_enable=YES            # enable passive connections
pasv_min_port=10000        # passive connections port range
pasv_max_port=10100        # passive connections port range
ssl_enable=YES             # enable FTPS
ssl_tlsv1=YES              # only TLS (not old SSL standards)
ssl_sslv2=NO               # only TLS (not old SSL standards)
ssl_sslv3=NO               # only TLS (not old SSL standards)
rsa_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
rsa_private_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
  • 如何使 FTP 服务器守护进程正常运行?
  • 配置文件有什么问题吗?

答案1

也许回答这个问题有点晚了,但对于有同样问题的人(比如我):

就我而言,问题是在我配置被动模式时开始的。添加 pasv_addr_resolve 和 pasv_address 条目解决了该问题。我只尝试过 pasv_address 和服务器 IP,但没有成功。

pasv_enable=YES
pasv_min_port=40000
pasv_max_port=41000
pasv_addr_resolve=YES
pasv_address=<your-domain>

另外,检查防火墙是否允许配置端口中的连接。

相关内容