4

For my network security class I have to set up an FTP server on a virtual machine. We are set up with 3 VM's - Gateway, Client, and Server. I have installed vsftpd using the command:

sudo apt-get install vsftpd

I then created a configuration file vsftpd-anon.conf in the location /etc/vsftpd/. 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.168.50.5
listen_port=21

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

sudo vsftpd /etc/vsftpd/vsftpd-anon.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 this:

enter image description here

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

Does the same thing. I have already tried reinstalling. Anyone know what is going on?

  • Which version of Ubuntu are you using? – mjturner Jul 28 '15 at 13:42
2

You are correct in determining the root cause of the error - could not bind listening IPv4 socket means that something is already listening to port 21 (the default ftp server port).

To stop the currently running vsftpd correctly:

sudo service vsftpd stop

Once you've done that, start your daemon with the customised init script:

sudo vsftpd /etc/vsftpd/vsftpd-anon.conf

Once you've confirmed that it's working, you'll need to change your init scripts and disable the existing vsftpd service so that it doesn't automatically start on bootup.

0

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:

1) To View which ftp service is running use

$ lsof -i | grep ftp

2) To stop xinetd :

$ sudo service xinetd stop

3) After stoping xinetd restart your vsftpd service by typing :

$ /etc/init.d/vsftpd restart (Become root and run this command)

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.