Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a rule like this in my jail.local file:


enabled = true
port    = ssh,sftp
filter  = sshd-ddos
logpath  = /var/log/messages
maxretry = 4

If I want to use a custom port for SSH, does Fail2ban automatically infer it from my sshd_config file or should I specify the port numerically?

share|improve this question
up vote 3 down vote accepted

You must specify the custom port in the [ssh] section, something like this:

share|improve this answer
Thanks, wanted to double check. Thought it might read the sshd_config (that'd be sweet). – Trent Scott Oct 3 '11 at 0:24
It reads /etc/services for standard port names. – Selivanov Pavel Dec 6 '11 at 22:30

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.