11

I have Rapsberry Pi B+ with Arch Linux installation. uname reports version:

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

I've installed ftp server via pacman -S vsftpd and installation has passed without any errors. Then I tried to configure it, which resulted in following 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

Now, when I try to restart vsftpd, I get:

[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)

Here is also output of 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.

Here is unit script /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

If I run sudo /usr/bin/vsftpd, I get following error:

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

I have corrected file permissions for /etc/vsftpd.conf via sudo chown root:root /etc/vsftpd.conf and now manually server gets started. I am also aware date/time is not correct, I haven't setup it yet.What am I missing?

3
  • 1
    Well the error is INVALIDARGUMENT. Take a look at the unit script and the man page to see if you can figure out which arg is invalid.
    – bahamat
    Commented Jan 28, 2015 at 12:53
  • @bahamat, I've added unit script listing, but inside of it I do not see any anomaly. Commented Jan 28, 2015 at 14:25
  • 1
    Could you please list the permissions and ownership of the the vsftpd.conf file?
    – geekbass
    Commented Jan 28, 2015 at 18:47

5 Answers 5

15

If someone stumble upon this problem with vsftpd, please check what error do you get by command:

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

If it is:

500 OOPS: SSL: cannot load RSA private key

Then regenerate SSL certificate (or reissue from your provider):

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

My working /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

If you wish to see dot-starting file names, add:

force_dot_files=YES
8

I've reset the permissions for /etc/vsftpd.conf to root:root via sudo chown root:root /etc/vsftpd.conf and now the vsftpd server get started via sudo systemctl restart vsftpd.service and running it manually via sudo /usr/bin/vsftpd.

1
  • For me the owner of /etc/vsftpd.conf was root:root and the service did not start by itself. Resetting the chown and starting manually did the job for some reason.
    – Mios
    Commented Apr 11, 2023 at 18:07
5

step 1 : check the vsftpd.conf

listen=YES
local_enable=YES
write_enable=YES
local_umask=022
dirmessage_enable=YES
use_localtime=YES
xferlog_enable=YES
secure_chroot_dir=/var/run/vsftpd/empty
pam_service_name=vsftpd
rsa_cert_file=/etc/ssl/private/vsftpd.pem

Step 2 : To View which ftp service is running use

$ lsof -i | grep ftp 

step 3 : To stop xinetd

$ sudo service xinetd stop

Step 4: After stopping xinetd restart your vsftpd service by typing

$ /etc/init.d/vsftpd restart
0

I got the same failure (ExecStart=/usr/bin/vsftpd (code=exited, status=2)). The root cause was that the certificate was not prepared because I gave all empty info for country, state, etc.

So don't do this:

For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:.
State or Province Name (full name) [Some-State]:.
Locality Name (eg, city) []:.
Organization Name (eg, company) [Internet Widgits Pty Ltd]:.
Organizational Unit Name (eg, section) []:.
Common Name (e.g. server FQDN or YOUR name) []:.
Email Address []:.

What I overlooked at first was the result of this:

error, no objects specified in config file
problems making Certificate Request
0

I got the same status error: 2/INVALIDARGUMENT

For me the problem had to do with this passive address resolution I have in my configuration:

pasv_addr_resolve=YES
pasv_address=xxx.yyy.org

This requires a running internet connection at startup to resolve the address. To make this work I had to do

sudo systemctl edit vsftpd

And add these following lines:

[Unit]
Wants=network-online.target
After=network-online.target

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .