Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

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 want to block access from some external host to my ssh deamon. Is there something in the sshd_config file I can set?

Just if this matters: I'm on a Synology 1010+ with openssh installed from ipgk, if this matters.

share|improve this question
up vote 2 down vote accepted

you can do this by adding the following to your sshd_config

DenyUsers username@host

for example when you want to ssh acces from the 80.25 ip-range for root:

DenyUsers root@80.25.*

From the manpages:

The allow/deny directives are processed in the following order: DenyUsers, AllowUsers, DenyGroups, and finally AllowGroups.

share|improve this answer
Of course, the best thing to do is set up iptables rules, though I don't know if that is possible. It seems that DenyUsers also supports wildcards for the username, so DenyUsers *@80.25.* would be the way to block everyone from 80.25. – chutz May 27 '12 at 22:25

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.