M
M
Mars362021-02-22 19:09:47
linux
Mars36, 2021-02-22 19:09:47

Why does VSFTPD drop the connection when trying to use the ls command?

After authorization on the server, I can navigate through the directories and create them, but when I try to find out the contents, the server breaks the connection. Example:

Connected to localhost.
220 (vsFTPd 3.0.3)
Name (localhost:ilya): ilya
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> cd etc/ftp
250 Directory successfully changed.
ftp> pwd
257 "/home/ilya/etc/ftp" is the current directory
ftp> ls
200 PORT command successful. Consider using PASV.
421 Service not available, remote server has closed connection
ftp>


config

anonymous_enable=NO
local_enable=YES
write_enable=YES
dirmessage_enable=YES
xferlog_enable=YES
connect_from_port_20=YES
listen=YES
pam_service_name=vsftpd
local_umask=0666
userlist_enable=YES
userlist_file=/etc/vsftpd.user_list
userlist_deny=NO



FIleZilla Output

Статус: Соединяюсь с 127.0.0.1:21...
Статус: Соединение установлено, ожидание приглашения...
Статус: Небезопасный сервер, не поддерживает FTP через TLS.
Статус: Авторизовались
Статус: Получение списка каталогов...
Команда: PWD
Ответ: 257 "/home/ilya" is the current directory
Команда: TYPE I
Ответ: 200 Switching to Binary mode.
Команда: PASV
Ответ: 227 Entering Passive Mode (127,0,0,1,94,187).
Команда: LIST
Ошибка: Could not read from transfer socket: ECONNRESET - Соединение сброшено сервером
Ошибка: Соединение закрыто сервером
Ошибка: Не удалось получить список каталогов


logs

Mon Feb 22 18:42:19 2021 [pid 1] [ilya] OK LOGIN: Client "127.0.0.1"
Mon Feb 22 18:42:47 2021 [pid 3] [ilya] OK MKDIR: Client "127.0.0.1", "/home/ilya/etc/ftp/files"
Mon Feb 22 18:43:31 2021 [pid 2] CONNECT: Client "127.0.0.1"
Mon Feb 22 18:43:35 2021 [pid 1] [ilya] OK LOGIN: Client "127.0.0.1"
Mon Feb 22 18:43:35 2021 [pid 2] CONNECT: Client "127.0.0.1"
Mon Feb 22 18:43:35 2021 [pid 1] [ilya] OK LOGIN: Client "127.0.0.1"
Mon Feb 22 18:48:04 2021 [pid 2] CONNECT: Client "127.0.0.1"
Mon Feb 22 18:48:09 2021 [pid 1] [ilya] OK LOGIN: Client "127.0.0.1"
Mon Feb 22 18:49:19 2021 [pid 2] CONNECT: Client "127.0.0.1"
Mon Feb 22 18:49:19 2021 [pid 1] [ilya] OK LOGIN: Client "127.0.0.1"
Mon Feb 22 18:49:19 2021 [pid 2] CONNECT: Client "127.0.0.1"
Mon Feb 22 18:49:19 2021 [pid 1] [ilya] OK LOGIN: Client "127.0.0.1"
Mon Feb 22 18:49:21 2021 [pid 2] CONNECT: Client "127.0.0.1"
Mon Feb 22 18:49:21 2021 [pid 1] [ilya] OK LOGIN: Client "127.0.0.1"
Mon Feb 22 18:49:22 2021 [pid 2] CONNECT: Client "127.0.0.1"
Mon Feb 22 18:49:22 2021 [pid 1] [ilya] OK LOGIN: Client "127.0.0.1"
Mon Feb 22 18:49:23 2021 [pid 2] CONNECT: Client "127.0.0.1"
Mon Feb 22 18:49:23 2021 [pid 1] [ilya] OK LOGIN: Client "127.0.0.1"
Mon Feb 22 18:49:23 2021 [pid 2] CONNECT: Client "127.0.0.1"
Mon Feb 22 18:49:23 2021 [pid 1] [ilya] OK LOGIN: Client "127.0.0.1"
Mon Feb 22 18:49:42 2021 [pid 2] CONNECT: Client "127.0.0.1"
Mon Feb 22 18:49:48 2021 [pid 1] [ilya] OK LOGIN: Client "127.0.0.1"
Mon Feb 22 18:50:20 2021 [pid 2] CONNECT: Client "127.0.0.1"
Mon Feb 22 18:50:20 2021 [pid 2] CONNECT: Client "127.0.0.1"
Mon Feb 22 18:50:27 2021 [pid 1] [ilya] OK LOGIN: Client "127.0.0.1"
Mon Feb 22 18:50:35 2021 [pid 2] CONNECT: Client "127.0.0.1"
Mon Feb 22 18:50:35 2021 [pid 2] CONNECT: Client "127.0.0.1"
Mon Feb 22 18:50:37 2021 [pid 1] [ilya] OK LOGIN: Client "127.0.0.1"
Mon Feb 22 18:59:57 2021 [pid 2] CONNECT: Client "127.0.0.1"
Mon Feb 22 19:00:01 2021 [pid 1] [ilya] OK LOGIN: Client "127.0.0.1"

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
akelsey, 2021-02-22
@Mars36

I guess:

200 PORT command successful. Consider using PASV.

indicates that vsftpd is running in active mode.
Therefore, he offers you to switch to passive mode.
something like:
pasv_enable=YES
pasv_min_port=50500
pasv_max_port=50550
(and don't forget to open this range in iptables or whatever you use as a firewall)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question