FTP is a bit odd in that to allow inbound traffic on port 21 and outbound traffic on port 20 :
sudo iptables -A INPUT -p tcp --dport 21 -j ACCEPT
sudo iptables -A OUTPUT -p tcp --sport 20 -j ACCEPT
In addition ftp will use a random higher port. To allow this you need to load the ip_conntrack_ftp module on boot. Uncomment and modify the IPTABLES_MODULES line in the /etc/sysconfig/iptables-config file to read
You will still need a way to save your iptables configuration and restore it when you boot. Ubuntu does not have a simple way of doing this. Basically you can either use
/etc/rc.local or disable NetworkManager and use networking scripts.
First save your rules:
sudo iptables-save /etc/iptables.save
Method 1 : Edit
/etc/rc.local and add the line
Method 2 : Edit
/etc/network/interfaces and use "post-up" to bring our iptables rules up.
iface lo inet loopback
iface eth0 inet dhcp
post-up /sbin/iptables-restore /etc/iptables.save
The preferred method is probably to use UFW
sudo ufw allow ftp
UFW is the fedault tool for Ubuntu, uses syntax very similar to iptables, and is enabled and restored on rebooting.