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

Is posible to limit user login using iptables? It's like if one user is logged in, no one else can log in using that user.

I try this command:

iptables -A INPUT -p tcp --syn --dport 22 -m connlimit --connlimit-above 1 -j REJECT

It can limit user login, but just for 1 IP. I still can login using another PC with different IP Address.

Thank you

share|improve this question
up vote 1 down vote accepted

No, it's not possible. Iptables has no way to tell if two different ssh connections come from the same user or from different users. Look at this answer in for the correct way to restrict multiple ssh logins from the same user, using sshd configuration rather than iptables.

share|improve this answer

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.