Linux Bash: Setting iptables rules to allow both active and passive FTP

后端 未结 5 1054
广开言路
广开言路 2021-02-04 10:57

I have a PC on which I have a FTP server installed. I want to set the iptables rules to allow both active and passive FTP. I\'ve tried the following code that people report is w

5条回答
  •  长发绾君心
    2021-02-04 11:23

    The arguments for the INPUT and OUTPUT lines need to be flipped in the # Allow FTP connections @ port 21 section otherwise new (active) FTP connections will be blocked.

    # Allow FTP connections @ port 21
    $IPT -A INPUT -p tcp --dport 21 -m state --state NEW,ESTABLISHED -j ACCEPT
    $IPT -A OUTPUT  -p tcp --sport 21 -m state --state ESTABLISHED -j ACCEPT
    

提交回复
热议问题