I am currently struggling with some kind of connection problem with vsftpd.I am using an arch linux and have vsftpd version 3.0.3 installed.I don't use iptables or anything. When I connect to my FTP server, I am successfully able to log in and browse directories. I am also able to up- and download files.The FTP user is chrooted into his home directory, and all subdirectories are owned by the ftp user.The current structure:|- home_dir   |- dir1      |- dir2         |- dir3         |- dir3         |- dir4         |- ...I am able to cd into dir1, do a ls and up / download files.I am also able to cd into dir2, but here comes the tricky part:I can perfectly upload files into dir2, but when I do a ls, the server is closing the connection saying: 421 Service not available, remote server has closed connection.I figured out, that the cause are several of the subdirectories of dir2. I figured out, that the existence of 8 of all subdirectories are causing the connection to be closed. Once I remove them, the listing works fine. All names are containing lower letters from a to z, no special chars.My ftp config:log_ftp_protocol=YESanonymous_enable=NOuserlist_enable=YESuserlist_file=/etc/vsftpd.user_listuserlist_deny=NOpasv_addr_resolve=YESpasv_address=mydomain.compasv_enable=Yespasv_min_port=40020pasv_max_port=40030local_enable=YESwrite_enable=YESlocal_umask=002dirmessage_enable=YESxferlog_enable=YESconnect_from_port_20=YESchown_uploads=YESchown_username=myuserftpd_banner=Welcome.chroot_local_user=YESAnd that's what the servers FTP-Log says:Wed Dec 28 13:55:06 2016 [pid 2] CONNECT: Client <client_ip>Wed Dec 28 13:55:06 2016 [pid 2] FTP response: Client <client_ip>, 220 Welcome.Wed Dec 28 13:55:07 2016 [pid 2] FTP command: Client <client_ip>, USER myuserWed Dec 28 13:55:07 2016 [pid 2] [myuser] FTP response: Client <client_ip>, 331 Please specify the password.Wed Dec 28 13:55:07 2016 [pid 2] [myuser] FTP command: Client <client_ip>, PASS <password>Wed Dec 28 13:55:07 2016 [pid 1] [myuser] OK LOGIN: Client <client_ip>Wed Dec 28 13:55:07 2016 [pid 3] [myuser] FTP response: Client <client_ip>, 230 Login successful.Wed Dec 28 13:55:07 2016 [pid 3] [myuser] FTP command: Client <client_ip>, OPTS UTF8 ONWed Dec 28 13:55:07 2016 [pid 3] [myuser] FTP response: Client <client_ip>, 200 Always in UTF8 mode.Wed Dec 28 13:55:07 2016 [pid 3] [myuser] FTP command: Client <client_ip>, PWDWed Dec 28 13:55:07 2016 [pid 3] [myuser] FTP response: Client <client_ip>, 257 / is the current directoryWed Dec 28 13:55:07 2016 [pid 3] [myuser] FTP command: Client <client_ip>, TYPE IWed Dec 28 13:55:07 2016 [pid 3] [myuser] FTP response: Client <client_ip>, 200 Switching to Binary mode.Wed Dec 28 13:55:07 2016 [pid 3] [myuser] FTP command: Client <client_ip>, PASVWed Dec 28 13:55:07 2016 [pid 3] [myuser] FTP response: Client <client_ip>, 227 Entering Passive Mode (<server_ip>,156,86).Wed Dec 28 13:55:07 2016 [pid 3] [myuser] FTP command: Client <client_ip>, LISTWed Dec 28 13:55:07 2016 [pid 3] [myuser] FTP response: Client <client_ip>, 150 Here comes the directory listing.Wed Dec 28 13:55:08 2016 [pid 3] [myuser] FTP response: Client <client_ip>, 226 Directory send OK.Wed Dec 28 13:55:09 2016 [pid 3] [myuser] FTP command: Client <client_ip>, CWD /dir1Wed Dec 28 13:55:09 2016 [pid 3] [myuser] FTP response: Client <client_ip>, 250 Directory successfully changed.Wed Dec 28 13:55:09 2016 [pid 3] [myuser] FTP command: Client <client_ip>, PASVWed Dec 28 13:55:09 2016 [pid 3] [myuser] FTP response: Client <client_ip>, 227 Entering Passive Mode (<server_ip>,156,92).Wed Dec 28 13:55:09 2016 [pid 3] [myuser] FTP command: Client <client_ip>, LISTWed Dec 28 13:55:09 2016 [pid 3] [myuser] FTP response: Client <client_ip>, 150 Here comes the directory listing.Wed Dec 28 13:55:09 2016 [pid 3] [myuser] FTP response: Client <client_ip>, 226 Directory send OK.Wed Dec 28 13:55:11 2016 [pid 3] [myuser] FTP command: Client <client_ip>, CWD /dir1/dir2Wed Dec 28 13:55:11 2016 [pid 3] [myuser] FTP response: Client <client_ip>, 250 Directory successfully changed.Wed Dec 28 13:55:11 2016 [pid 3] [myuser] FTP command: Client <client_ip>, PASVWed Dec 28 13:55:11 2016 [pid 3] [myuser] FTP response: Client <client_ip>, 227 Entering Passive Mode (<server_ip>,156,87).Wed Dec 28 13:55:11 2016 [pid 3] [myuser] FTP command: Client <client_ip>, LISTWed Dec 28 13:55:11 2016 [pid 3] [myuser] FTP response: Client <client_ip>, 150 Here comes the directory listing.The log always stops after 150 Here comes the directory listing.. I tried it several times.And this is, what I see, when I use the ftp command on my terminal:$ ftp -n 127.0.0.1Connected to 127.0.0.1.220 Welcome.ftp> user myuser331 Please specify the password.Password:230 Login successful.ftp> ls200 PORT command successful. Consider using PASV.150 Here comes the directory listing.drwxr-xr-x    4 1000     1000         4096 Dec 28 13:27 dir1226 Directory send OK.ftp> cd dir1250 Directory successfully changed.ftp> ls200 PORT command successful. Consider using PASV.150 Here comes the directory listing.-rwxr-xr-x    1 1000     1000       469504 Dec 23 03:03 file_1-rw-r--r--    1 1000     1000          186 Feb 19  2016 file_2-rw-r--r--    1 1000     1000       121856 Dec 23 00:16 file_3-rw-r--r--    1 1000     1000       118272 Feb 12  2016 file_4-rw-r--r--    1 1000     1000        88232 Mar 22  2016 file_5-rw-r--r--    1 1000     1000        64680 Mar 22  2016 file_6-rw-r--r--    1 1000     1000       101032 Mar 22  2016 file_7-rw-r--r--    1 1000     1000         6144 Mar 22  2016 file_8-rw-r--r--    1 1000     1000       899584 Mar 22  2016 file_9drwxrwxr-x   42 1000     1000         4096 Dec 28 11:38 dir2226 Directory send OK.ftp> cd dir2250 Directory successfully changed.ftp> pwd257 /dir1/dir2 is the current directoryftp> ls200 PORT command successful. Consider using PASV.150 Here comes the directory listing.421 Service not available, remote server has closed connectionThanks a lot for help.
vsftpd closes conntion with code 421 when listing directory content
arch linux;ftp;vsftpd