curl -s https://install.crowdsec.net | sudo sh, then install the engine with sudo apt install crowdsec (Ubuntu/Debian) or sudo dnf install crowdsec (AlmaLinux/Rocky). Add a firewall bouncer such as crowdsec-firewall-bouncer-nftables, because the engine on its own only detects attacks and does not block them.
CrowdSec reads your logs (SSH, nginx, Apache and more), spots attacks such as password guessing or web scans, and creates a decision to ban the attacking IP. A bouncer enforces that decision, for example in your firewall. CrowdSec can also share and receive attacker IPs with its community blocklist.
Before you start
- You need root or a sudo user. Root users can leave out
sudo. - Run CrowdSec or Fail2Ban for SSH, not both, so two tools do not ban the same traffic.
- Know your own public IP address so you can allowlist it.
- If you block yourself, use the VNC console. On a dedicated server, open a ticket if you need console access.
How to install CrowdSec
1
Add the CrowdSec repository
curl -s -o crowdsec-repo.sh https://install.crowdsec.net, read it, then run sudo sh crowdsec-repo.sh.2
Install the engine
- Ubuntu / Debian
- AlmaLinux / Rocky
3
Install a firewall bouncer
- Ubuntu / Debian
- AlmaLinux / Rocky
-iptables package also exists for older setups. The bouncer settings are in /etc/crowdsec/bouncers/crowdsec-firewall-bouncer.yaml.4
Allowlist your own IP address
How to protect SSH and other services
Check which collections are installed:crowdsecurity/sshd. Add it, or others for your web server, if they are missing:
How to check it worked
1
Check the service
active (running).2
Check that logs are read
3
Check that the bouncer is connected
4
Trigger the SSH test scenario
From another computer, run the official test login (it is harmless and only creates an alert):Then on the server:The alert appears in the list.
How to see and remove bans
CrowdSec vs Fail2Ban: which should I use?
Both protect SSH well. Choose Fail2Ban for a simple, self-contained setup and CrowdSec if you want shared blocklists or protection for several services from one tool.
Frequently asked questions
Does CrowdSec block anything without a bouncer?
No. The engine only creates alerts and decisions. Install a bouncer to enforce them.Does CrowdSec send my logs to CrowdSec?
The engine connects to the CrowdSec Central API to download the community blocklist and to report attacks it detected. Check the connection withsudo cscli capi status. Read the CrowdSec documentation for what is shared and how to change it.
How do I unban myself if I am locked out?
Log in through the VNC console and runsudo cscli decisions delete --ip with your IP. Then add your IP to your allowlist.
Related guides
VPS and dedicated server guides
Every guide in this section.
Set up Fail2Ban
The simpler alternative.
Check login history
See failed SSH attempts.
nftables and iptables
How the bans are applied.
Apply DDoS filters
Filter traffic before it reaches you.
Security checklist
Harden the rest of your server.
Checked against the official CrowdSec documentation (installation, firewall bouncer, health check and
cscli reference) on 4 November 2026. Commands can differ on other distributions or releases.Need Extra Help?
If you encounter any issues, our support team is ready to assist:- Live Chat: Quick assistance via our website.
- Support Ticket: Open a Ticket
- Discord: Join our Community
- Email: support@freakhosting.com
Last Updated: November 2026