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

We want to block all access to SSH, except for two IP addresses. One address is dynamic, it starts with where xxx is changing all the time. I read that you can do this by changing /etc/hosts.allow? How can we do this?

share|improve this question

This should be as trivial as

sshd : 124.567.890. : allow

share|improve this answer
Thanks, and multiple addresses? – Kevin Dec 31 '11 at 10:14
Nvm, found it: sshd: – Kevin Dec 31 '11 at 10:18
In /etc/hosts.deny, you'll need to put in "sshd: ALL", so your combined rule will be deny all, allow X. – cjc Dec 31 '11 at 10:29
Thanks, and how can I test the security? We only have one IP address right here. – Kevin Dec 31 '11 at 10:33
Is this relevant to your question?… – Sergei Dec 31 '11 at 10:52

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.