How Do You Whitelist an Ip Address with Just One Line Command?

I've been searching how to whitelist a IP address (ex. 123.123.321.1) with Ubuntu 12.04. But everyone seems to give long elaborate answers. Is there just 1 simple command to whitelist an IP address? I want to whitelist an IP address so it can connect via SSH port 22. Also would this solution work with other linux flavors like centos?

1 Answer

sudo ufw allow in from 123.123.321.1 to any port 22  

CentOS doesn't use ufw. You'll have to use iptables.

7

Your Answer

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

Sarah Jenkins

Sarah Jenkins

Senior Technology Editor & AI Specialist

Sarah Jenkins is a veteran tech journalist with over 12 years of experience covering artificial intelligence, mobile innovations, and digital ethics. Her insights have appeared in leading technology publications worldwide.

Share this article
Twitter Facebook Pinterest