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


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 unix.stackexchange.com for the correct way to restrict multiple ssh logins from the same user, using sshd configuration rather than iptables.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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