# [SOLVED] vsftpd: couldnot bind listening IPv4 socket

## salmonix

Hi there, 

trying to start vsftpd 2.1.0, I receive the error:

 *Quote:*   

> 500 OOPS: could not bind listening IPv4 socket
> 
> 

 

 *Quote:*   

> grep -v ^# vsftpd.conf
> 
> listen=YES
> 
> local_enable=YES
> ...

 

I do not use xinetd.

USE flags: pam ssl tcpd   - and without tcpd

I have also tried #listen=YES

No firewall.

No idea.

----------

## cach0rr0

hrmm...try this

```

listen=YES

anonymous_enable=NO

local_enable=YES

dirmessage_enable=YES

xferlog_enable=YES

connect_from_port_20=YES

xferlog_file=/var/log/vsftpd.log

idle_session_timeout=600

data_connection_timeout=120

ftpd_banner=Welcome to FACE-R service

chroot_local_user=YES

ls_recurse_enable=NO

local_umask=022

```

My use are pam ssl tcpd -caps -selinux -xinetd

Other thing to check

```

netstat -anp |grep :21

```

Make sure nothing else is listening.

----------

## salmonix

Ridiculous...

 *Quote:*   

> 500 OOPS: bad bool value in config file for: listen

 

What is good bool value, then?

Otherwise nope, p 21 is free. (Actually no other service is up, except the basic system services.)

----------

## cach0rr0

what the hell? 

I mean, i dont normally have my FTP server started unless i need to put something up for someone, but I just tested to make sure:

```

gentoob0x ~ # /etc/init.d/vsftpd start

 * Starting vsftpd ...                                                                                                                                                                    [ ok ]

gentoob0x ~ # netstat -anp |grep :21

tcp        0      0 0.0.0.0:21              0.0.0.0:*               LISTEN     32442/vsftpd

```

My entire config is as such (i have it chowned to apache because at one point I had users uploading everything to web-accessible directories)

```

listen=YES

anonymous_enable=NO

local_enable=YES

write_enable=YES

dirmessage_enable=YES

xferlog_enable=YES

# Make sure PORT transfer connections originate from port 20 (ftp-data).

chroot_local_user=YES

connect_from_port_20=YES

xferlog_file=/var/log/vsftpd.log

idle_session_timeout=600

data_connection_timeout=120

ftpd_banner= Generic FTP Daemon Ready

ls_recurse_enable=NO

chown_uploads=YES

chown_username=apache

local_umask=022

```

I would of course comment out chown_username should you choose to use my file verbatim. 

The only thing I can gather, maybe it can't create the pid file, or write to the log? (regarding the first error)

Could always strace it I suppose. Just an 

```
strace /usr/sbin/vsftpd /etc/vsftpd/vsftpd.conf
```

and see if it bombs out. If that runs successfully with your config file (the original one of course), you should see something like this as the last lines:

```

bind(3, {sa_family=AF_INET, sin_port=htons(21), sin_addr=inet_addr("0.0.0.0")}, 16) = 0

listen(3, 32)                           = 0

accept(3,

```

and it will sit like that until it gets a connection. If so, leaning towards a permissions issue. If not, looking at a configuration issue. 

Either way, strace should show something useful

My other thought would be for hardened-sources, if maybe you had any of the uid/gid socket protections turned on. If not hardened-sources, that of course does not apply to you.

----------

## salmonix

Solved. Unfortunately I do not know how - I am working under stress now and the solution got deleted from my memory giving place other things - if it was there ever.

Thanx for your concern.

----------

