I'm continuously getting the 500: Illegal port command, bind already in use

No matter what I do, I’m still getting this error. I have tried every thing and have read all the questions on forum related to this. Please help me regarding the same.
My port is running on 8081.
I have already tried killing all the running processes.
These are the parameters of my conf file.
anonymous_enable=NO
local_enable=YES
write_enable=YES
dirmessage_enable=YES
xferlog_enable=YES
connect_from_port_20=NO
listen=YES
listen_port=8081
vsftpd_log_file=/home/crio-user/workspace/vsftpd.log
xferlog_std_format=NO
syslog_enable=NO
log_ftp_protocol=YES
ftp_username=crio-user
pasv_enable=YES
Also, for reference, I’m adding this.
PS:
crio-user@ayusha04:~/workspace$ netstat -an
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 127.0.0.1:33867 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:8081 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.53:53 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN
tcp 0 0 192.168.27.96:52868 3.6.230.250:22 TIME_WAIT
tcp 0 0 192.168.27.96:60246 192.168.1.2:2049 ESTABLISHED
tcp 0 0 192.168.27.96:52872 3.6.230.250:22 TIME_WAIT
tcp6 0 0 :::111 :::* LISTEN
tcp6 0 0 :::8080 :::* LISTEN
tcp6 0 0 :::22 :::* LISTEN
tcp6 0 0 ::1:3350 :::* LISTEN
tcp6 0 0 :::3389 :::* LISTEN
tcp6 0 38 192.168.27.96:8080 13.235.56.115:54654 ESTABLISHED
tcp6 0 0 192.168.27.96:8080 35.154.54.251:37980 ESTABLISHED
udp 0 0 0.0.0.0:889 0.0.0.0:*
udp 0 0 0.0.0.0:38953 0.0.0.0:*
udp 0 0 127.0.0.53:53 0.0.0.0:*
udp 0 0 192.168.27.96:68 0.0.0.0:*
udp 0 0 0.0.0.0:111 0.0.0.0:*
udp 0 0 0.0.0.0:5353 0.0.0.0:*
udp6 0 0 :::889 :::*
udp6 0 0 :::39836 :::*
udp6 0 0 :::111 :::*
udp6 0 0 :::5353 :::*
raw6 0 0 :::58 :::* 7

what is the output of this cmd,
ps aux | grep vsftpd

This is after killing the running vsftpd.conf

crio-user@ayusha04:~/workspace/QBox$ ps aux | grep vsftpd
crio-us+ 6689 0.0 0.0 14856 1052 pts/0 S+ 14:58 0:00 grep --color=auto vsftpd

and can you see 8081 port in use, using netstat cmd

This is the ss of the terminal. sudo ./vsftpd vsftpd.conf is running in the other terminal.

looks like a firewall issue. Have you set the connect_from_port_20=NO in conf file

I have mentioned it in the question also, as you can see it is already set to NO.

Please see the below link for reference.
https://www.ucodice.com/blog/ftp-500-illegal-port-command/

I have added both these two lines, still facing the same problem.
pasv_enable=YES
pasv_promiscuous=YES

What about the other two lines?
pasv_max_port=Enter the max port range allowed on your server.
pasv_min_port=Enter the min port range allowed on your server.
Please add those too

Added these lines too. Still getting the same error.
pasv_min_port=8082
pasv_max_port=8083

crio-user@ayusha04:~/workspace/ftp_server$ ftp 3.6.239.82 8081
Connected to 3.6.239.82.
220 (vsFTPd 3.0.3)
Name (3.6.239.82:crio-user): crio-user
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> put download.txt
local: download.txt remote: download.txt
500 Illegal PORT command.
ftp: bind: Address already in use
ftp>

Right now, my conf file looks like this:
anonymous_enable=NO
local_enable=YES
write_enable=YES
dirmessage_enable=YES
xferlog_enable=YES
connect_from_port_20=NO
listen=YES
listen_port=8081
vsftpd_log_file=/home/crio-user/workspace/vsftpd.log
xferlog_std_format=NO
syslog_enable=NO
log_ftp_protocol=YES
ftp_username=crio-user
pasv_enable=YES
pasv_promiscuous=YES
pasv_min_port=8082
pasv_max_port=8083

Can you try to kill that process and start again. When you edit your config file you have to restart the server so the changed/new parameters reflect the change in behavior. Kill your process and start the server again.

No process to kill.
crio-user@ayusha04:~/workspace/ftp_server$ ps -ef | grep vsftpd
crio-us+ 7339 6639 0 15:33 pts/1 00:00:00 grep --color=auto vsftpd

I started again the vsftpd, started again the ftp, getting the same error

after login to ftp server enable passive mode
like run command PASS

Like this?

ftp> PASS
?Invalid command

yeah first login to ftp then
ftp>pass

@Ayush_Agarwal
Query solved or not?

omg. Resolved, thanks a lot man.Thanks a lot.

1 Like

Hey please don’t add any extra boolean options other than what are given in the taskboard,
Adding this boolean option may work now, but while you are transferring a file to the external client, it will not work.
Google some of the errors and understand, whatever the config file contains work through them, don’t add any extra values.