2

I need sshd to listen both on port 22225 (allowing connections on that port from any IP) and port 22 (allowing just a single static IP on that port).

In other words, listen on two ports at the same time while whitelisting connections only on one port. Is there a way to do that? I'm running ubuntu server 14.04.

1

You could configure your SSH server to listen to both ports, and then use iptables to restrict access to port 22 to a single IP number. Something like the following (where x.x.x.x is the IP number you want to allow):

iptables -A INPUT -p tcp --dport 22 -s x.x.x.x -j ACCEPT
iptables -A INPUT -p tcp --dport 22 -j DROP

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.