To safeguard your computer from being hacked, you can block ports of Operating System Linux Ubuntu through its Firewall. You can allow only required ports and block rest…