Installing vsftpd – 500 OOPS: could not bind listening IPv4 socket?

I have to set up a FTP server on my machine. I have installed vsftpd using the command:

sudo apt-get install vsftpd

I then edited the configuration file vsftpd.conf in the location /etc. The file contains:

#Set the server to run in standalone mode
listen=YES

#Enable anonymous access
local_enable=NO
anonymous_enable=YES

#Disable write access
write_enable=NO

#Set root directory for anon connections
anon_root=/var/ftp

#Limit retrieval rate
anon_max_rate=2048000

#Enable logging user login and file transfers. /var/log/vsftpd.log
xferlog_enable=YES

#Set interface and port
listen_address=192.120.43.250
listen_port=21

The IP address 192.120.43.250 is the eth0 for my server. When I run the command

sudo vsftpd /etc/vsftpd.conf

I get the error:

500 OOPS: could not bind listening IPv4 socket

To check to see what was running on port 21, I ran the command:

sudo netstat -tulpn

And saw that vsftpd process id was 29383 so I issued the command:

sudo killserver 29383

And checked again. The vsftpd was still there, but with a different PID. Running the command:

sudo killall vsftpd

and

sudo killall -9 vsftpd

Does the same thing. I have already tried reinstalling. Anyone know what is going on and how to fix it?

Asked By: Alper Turan

||

Remember to comment out

listen=YES

in your vsftpd.conf file so that you don’t run your vsftpd in standalone mode

It fixed the problem in my case.

Answered By: ARTURO

You are getting this error probably because of xinetd ftp is running.

The procedure mentioned below will resolve the following errors:

A) 500 OOPS: could not bind listening IPv4 socket, for vsftpd

B) Server hangup immediately after connect, for ncftpget

Follow the procedure mentioned below to rectify the error:

  • To View which ftp service is running use:

    $ lsof -i | grep ftp (Become root and run this command)
    
  • To stop xinetd:

    $ sudo service xinetd stop
    
  • After stoping xinetd restart your vsftpd service by typing :

    $ /etc/init.d/vsftpd restart  (Become root and run this command)
    
  • Also check the vsftpd.conf with this one:

    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
    
Answered By: Ankit Raj

In my case the error was due to the process was running.

Try the next:

$ sudo service vsftpd restart

The service should restart with the new configuration parameters, if any.

Answered By: Lorenzo Lerate

Maybe in the standalone mode,you have started the vsftpd service.And you just need to kill the vsftpd process,not need to change the config file.

Answered By: wenyu jiang

If above solutions did not worked then you are in the same situation as I was in. Now let’s resolve it.

First make sure to do listen=NO or comment the line that contain listen=YES and must set the port to either 8081 or standard ports. Then type ps -ef then a whole bunch of things appear like :

enter image description here

Then you extract the file in which you are interested in by typing the command :

ps -ef | grep vsftpd

Now, remember the PID number is in second column. Now, copy that number. Now you need to kill the vsftpd beacause it contains previous log and you just modified something into the vsftpd.conf file. Kill command is :

sudo kill <PID>

Ex. sudo kill 5392

Now, You are done with it.Now restart the server it will run perfectly.

Answered By: surya_bhai

In my case, uncommentting the following line in vsftpd.conf solved the problem:

write_enable=YES
Answered By: origami

The error means your system already have a vsftpd runing.It seems like that vsftpd start from inetd.You should find out the pid of vsftpd with this command:

netstat -tulpn | grep vsftpd

And then kill the process:

kill <pid>

And restart vsftpd:

/usr/local/sbin/vsftpd &

That may work.I solved the problem in my case.

Answered By: Kiopwias

vsftpd defaults to Listen_ipv6=YES. If you have no IPv6 available and you run it manually to look at the error, like this

$ sudo /usr/sbin/vsftpd /etc/vsftpd.conf
500 OOPS: socket

If you set Listen=YES you turn on IPv4, then you get

$ sudo /usr/sbin/vsftpd /etc/vsftpd.conf
500 OOPS: run two copies of vsftpd for IPv4 and IPv6

So you set listen_ipv6=NO and you run it again and get no errors. So you should be able to ^C out of the manual run and start up the service, at least that worked for me.

Answered By: cpu
Categories: Answers Tags: , , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.