How to close port 21?

Use sftp but pentest shows that 21 port is opened. How better to close through iptables or stop the ftp service? In the case of a reboot because it will rise again and it will be open? How best to proceed?
July 2nd 19 at 13:46
4 answers
July 2nd 19 at 13:48
Solution
SFTP and FTP are two different protocols. The first works via ssh on port 22, and the second at 21. If port 21 does not need anyone, it should be close or even delete the ftp server
That this was in fact the issue. Can be closed via iptables for example. What to do to stop or delete the ftp server? - Tyreek.Stoke commented on July 2nd 19 at 13:51
: It depends on the distro. If the batch (deb/rpm), then remove the appropriate package. Which distribution and which version? - Garland36 commented on July 2nd 19 at 13:54
Debian 8 - Tyreek.Stoke commented on July 2nd 19 at 13:57
: type in console sudo netstat-ntulp to see who is listening to port 21 - Garland36 commented on July 2nd 19 at 14:00
: it listens to only one program with the name vsftpd - Tyreek.Stoke commented on July 2nd 19 at 14:03
July 2nd 19 at 13:50
If the ftp you don't need, of course it is best to remove or at least disable it.
July 2nd 19 at 13:52
It is possible so
July 2nd 19 at 13:54
Add an appropriate rule in firewall IPTables.
iptables -A INPUT -p tcp --dport 21 -j DROP

Find more questions by tags Linux