Arch-Linux

vsftpd 無法啟動:“systemd111: vsftpd.service: 主程序退出,code=exited,status=2/INVALIDARGUMENT'

  • January 7, 2022

我有安裝 Arch Linux 的 Rapsberry Pi B+。uname報告版本:

[computer@computer001 ~]$ uname -a
Linux computer001 3.18.3-3-ARCH #1 PREEMPT Mon Jan 26 20:10:28 MST 2015 armv6l GNU/Linux

我已經安裝了 ftp 伺服器 viapacman -S vsftpd並且安裝已經通過,沒有任何錯誤。然後我嘗試配置它,結果如下vsftpd.conf

anonymous_enable=NO
local_enable=YES
write_enable=YES
#local_umask=022
anon_upload_enable=NO
anon_mkdir_write_enable=NO
dirmessage_enable=YES
xferlog_enable=YES
connect_from_port_20=YES
chown_uploads=YES
chown_username=computer
#xferlog_file=/var/log/vsftpd.log
#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 personal ftp service.
#deny_email_enable=YES
#banned_email_file=/etc/vsftpd.banned_emails
#chroot_local_user=YES
#chroot_list_enable=YES
#chroot_list_file=/etc/vsftpd.chroot_list
ls_recurse_enable=YES
listen=YES
#listen_ipv6=YES

現在,當我嘗試重新啟動時vsftpd,我得到:

[computer@computer001 etc]$ sudo systemctl restart vsftpd.service && systemctl status -l vsftpd.service
* vsftpd.service - vsftpd daemon
  Loaded: loaded (/usr/lib/systemd/system/vsftpd.service; enabled; vendor preset: disabled)
  Active: failed (Result: exit-code) since Thu 1970-01-01 06:32:24 UTC; 112ms ago
 Process: 350 ExecStart=/usr/bin/vsftpd (code=exited, status=2)
Main PID: 350 (code=exited, status=2)

這裡也是輸出sudo journalctl | grep -i vsftp

Jan 01 06:32:24 computer001001 sudo[347]: computer001 : TTY=pts/0 ; PWD=/etc ; USER=root ; COMMAND=/usr/bin/systemctl restart vsftpd.service
Jan 01 06:32:24 computer001001 systemd[1]: Starting vsftpd daemon...
Jan 01 06:32:24 computer001001 systemd[1]: Started vsftpd daemon.
Jan 01 06:32:24 computer001001 systemd[1]: vsftpd.service: main process exited, code=exited, status=2/INVALIDARGUMENT
Jan 01 06:32:24 computer001001 systemd[1]: Unit vsftpd.service entered failed state.
Jan 01 06:32:24 computer001001 systemd[1]: vsftpd.service failed.

這是單元腳本/usr/lib/systemd/system/vsftpd.service

[Unit]
Description=vsftpd daemon
After=network.target

[Service]
ExecStart=/usr/bin/vsftpd
ExecReload=/bin/kill -HUP $MAINPID
KillMode=process

[Install]
WantedBy=multi-user.target

如果我執行sudo /usr/bin/vsftpd,我會收到以下錯誤:

500 OOPS: config file not owned by correct user, or not a file

我已經更正了/etc/vsftpd.confvia的文件權限sudo chown root:root /etc/vsftpd.conf,現在手動啟動伺服器。我也知道日期/時間不正確,我還沒有設置它。我錯過了什麼?

我已經重置了/etc/vsftpd.confto root:rootvia的權限sudo chown root:root /etc/vsftpd.conf,現在vsftpd伺服器通過 啟動sudo systemctl restart vsftpd.service並手動執行它sudo /usr/bin/vsftpd

如果有人偶然發現 vsftpd 的這個問題,請檢查你通過命令得到什麼錯誤:

/usr/sbin/vsftpd /etc/vsftpd.conf

如果是:

500 OOPS: SSL: cannot load RSA private key

然後重新生成 SSL 證書(或從您的提供商重新頒發):

sudo openssl req -x509 -nodes -days 1095 -newkey rsa:2048 -keyout /etc/ssl/private/vsftpd.pem -out /etc/ssl/private/vsftpd.pem

我的工作/etc/vsftpd.conf

anonymous_enable=NO
connect_from_port_20=YES
dirmessage_enable=YES
force_local_data_ssl=YES
force_local_logins_ssl=YES
listen_ipv6=YES
listen=NO
local_enable=YES
local_umask=022
pam_service_name=vsftpd
pasv_enable=Yes
pasv_max_port=10200
pasv_min_port=10100
rsa_cert_file=/etc/ssl/private/vsftpd.pem
rsa_private_key_file=/etc/ssl/private/vsftpd.pem
secure_chroot_dir=/var/run/vsftpd/empty
ssl_ciphers=HIGH
ssl_enable=YES
ssl_sslv2=NO
ssl_sslv3=NO
ssl_tlsv1=YES
use_localtime=YES
write_enable=YES
xferlog_enable=YES

如果您希望查看以點開頭的文件名,請添加:

force_dot_files=YES

引用自:https://unix.stackexchange.com/questions/181436