0

OS I'am using CentOS 6.10

I am trying to configure active mode ftp by opening port 20 and 21 only. (Exactly I don't no how to configure active mode ftp)

This is my iptables rule.

[root@server ~]# iptables -L -n
Chain INPUT (policy DROP)
target     prot opt source               destination         
ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0           tcp dpt:22 
ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0           tcp dpt:21 
ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0           tcp dpt:20 

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination  

And I added pasv_enable=NO in /etc/vsftpd/vsftod.conf file

If I try to access ftp server using ftp command I am able to access.

max@client:~$ ftp 192.168.43.5
Connected to 192.168.43.5.
220 (vsFTPd 2.2.2)
Name (192.168.43.5:suraj): ftp
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> ls
200 PORT command successful. Consider using PASV.
150 Here comes the directory listing.
drwxr-xr-x    3 0        0            4096 Dec 28 07:50 pub
226 Directory send OK.
ftp> cd pub
250 Directory successfully changed.
ftp> ls
200 PORT command successful. Consider using PASV.
150 Here comes the directory listing.
drwxr-xr-x    2 0        0            4096 Dec 28 07:51 data
226 Directory send OK.
ftp> cd data
250 Directory successfully changed.
ftp> ls
200 PORT command successful. Consider using PASV.
150 Here comes the directory listing.
-rw-r--r--    1 0        0            1796 Dec 28 07:51 file.txt
226 Directory send OK.
ftp> get file.txt
local: file.txt remote: file.txt
200 PORT command successful. Consider using PASV.
150 Opening BINARY mode data connection for file.txt (1796 bytes).
226 Transfer complete.
1796 bytes received in 0.00 secs (3780.0 kB/s)
ftp> 

If I try to access ftp using browser I am unable to access.

enter image description here Any other port need to open?

To open ftp content in browser what need to change ?

5
  • 550 Permission denied error coming.
    – max
    Dec 28, 2018 at 8:17
  • active mode means the data connections from the server originate from port 20 and not that the client connects to port 20 as you assume in your iptables setup. Thus the iptables rules are wrong. Additionally active mode will usually fail with clients behind NAT or firewalls - which means it will mostly work in the local network only but not on the internet. Dec 28, 2018 at 8:28
  • @SteffenUllrich can you write(update my rule) iptables rule in answer section.
    – max
    Dec 28, 2018 at 8:35
  • As I said: active mode will not work for the majority of users anyway since they are behind NAT or firewall. So why bother fixing the iptables rules. FTP is just terrible and browsers moving more and more away from supporting it anyway. Dec 28, 2018 at 8:38
  • This you may find interesting. Especially paragraphs 2, 3 and 4. Dec 28, 2018 at 10:10

1 Answer 1

-1

try putting ftp://username:password:[email protected] in the url
username -> your username
password -> your password

You must log in to answer this question.

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