I'm able to log into FTP but I'm not seeing any files or folders.

My iptables looks like this

-A INPUT -p udp -m udp --dport ftp-data -j ACCEPT
-A INPUT -p udp -m udp --dport ftp -j ACCEPT
-A INPUT -p tcp -m tcp --dport https -j ACCEPT
-A INPUT -p tcp -m tcp --dport http -j ACCEPT
-A INPUT -p tcp -m tcp --dport ftp-data -j ACCEPT
-A INPUT -p tcp -m tcp --dport ftp -j ACCEPT

When I ftp to localhost from the server itself, I'm getting the following error:

230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> debug
Debugging on (debug=1).
ftp> ls
ftp: setsockopt (ignored): Permission denied
---> PASV
227 Entering Passive Mode (127,0,0,1,221,184)
---> LIST
150 Here comes the directory listing.
226 Directory send OK.

Switching from passive to active gives me the same error:

ftp> passive
Passive mode off.
ftp> ls
ftp: setsockopt (ignored): Permission denied
---> PORT 127,0,0,1,233,166
200 PORT command successful. Consider using PASV.
---> LIST
150 Here comes the directory listing.
226 Directory send OK.

Passive mode shouldn't work because I haven't opened or specified a port-ranage, but active mode should work with these settings right?

Update 1

Config file VSFTPD:


Another note: I log in with my own user to /home/user and can't see any folders. But when I cd to / the folders are displayed without error messages.

  • 1
    It's not an IPTables issue if you're getting that much data back and forth - it's a folder permissions issue.
    – Chopper3
    Aug 13, 2011 at 15:29
  • Please post your configuration file.
    – quanta
    Aug 13, 2011 at 15:35
  • Config file posted and note added Aug 13, 2011 at 15:43
  • I suggest you enable log on FTP server to see what it says. Did you try with other FTP clients?
    – quanta
    Aug 14, 2011 at 14:41
  • 1
    Could be SELinux interfering. Try typing setenforce 0 to disable and see if it works then?
    – Xhantar
    Aug 14, 2011 at 15:20

1 Answer 1


Per the comments, disabling SELinux seems to have solved the problem. I would suggest to now:

  1. Turn it back on with setenforce 1.
  2. Use ls -Z /path/to/ftp/home/folder to check the context of the directory you're trying to FTP into, and see if the context is "public_content_t"
  3. If not, use restorecon(8) to fix incorrect context, e.g. restorecon -R /path/to/ftp/home/folder
  • the context is indeed not set to public_content_t, however step 3 doesn't change that. I'll read up on restorecon and report back. Aug 14, 2011 at 16:22
  • Also look at the chcon(1) and setsebool(8) commands. It might be as simple as doing setsebool -P ftp_home_dir=1 (allow users access to their home directories in SELinux). Note that it might take a while for changes made using setsebool to take effect while pending changes are written to the policy file on disk (a minute or so).
    – Xhantar
    Aug 14, 2011 at 16:43
  • Have a look at beginlinux.com/blog/2008/11/vsftpd-and-selinux-on-centos
    – Xhantar
    Aug 14, 2011 at 16:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .