To ensure UFW (Uncomplicated Firewall) starts automatically on Linux when the server boots, follow these steps:
✅ 1. Enable UFW service at startup
Use systemctl to enable the ufw systemd service:
sudo systemctl enable ufw
This creates a symlink so that the UFW service starts automatically on boot.
✅ 2. Start UFW now (if not already started)
sudo ufw enable
If already enabled, you can check the status:
sudo ufw status verbose
✅ 3. Verify it’s enabled at boot
After a reboot, check:
sudo systemctl status ufw
You should see something like:
Active: active (exited)
✅ 4. Optional: Check UFW is loaded in default runlevels (SysVinit)
If your system uses SysVinit instead of systemd:
sudo ufw status
sudo ufw enable
sudo update-rc.d ufw enable
But this is rarely needed on modern systems.
Leave a Reply