Take the tour ×  Since a potential attacker will exploit the
services that are already open to public by firewall rules, how
will a firewall help to protect my server from attackers?
share|improve this question This question should be revised. It
should probably read "How does a firewall help to protect a
server". rather than asking specifics about the misconception
that a firewall will truly protect everything. (A firewall is
just one part of a working IT security solution) –  Thomas W.
May 7 at 4:45 add comment  2 Answers  up vote 10 down vote
accepted  A firewall allows you to limit access to ports you
specify, and you can specify sources as well. For example, you
can prevent non-root users from creating services that accept
connections, so an attacker can't create a new shell backdoor.
You can even limit outbound connections to reduce the
possibility of reverse shells. A not uncommon practice is to
only allow SSH connections from "internal" IPs.  Security is
about minimizing attack surface, and a firewal