[B]how can i configure SSH to allow only the ip that i want?[/B]
Linux - SecurityThis forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
You need to use a iptables to filter connections.
If you are new to Linux you may want to sue some thing simple to set up your firewall. One very good and simple firewall is Firestarter.
Take a look here: http://www.fs-security.com/
This is off the top of my head, so might need a fix.
Code:
allow="
10.41.0.1
10.41.0.2
"
iptables -P INPUT DROP
iptables -P FORWARD DROP
iptables -P OUTPUT ACCEPT
iptables -A INPUT -i lo -j ACCEPT
iptables -A INPUT -i eth0 -m state --state ESTABLISHED,RELATED -j ACCEPT
for ip in $allow; do
iptables -A INPUT -i eth0 -p tcp -s $ip --dport 22 -m state --state NEW -j ACCEPT;
done
Or modify sshd to look for hosts.allow, but iptables is a good way to go (because it stops sshd from even hearding abot the connection if it's undesirable). Just offering an alternative
sorry but .. i did that and my computer continues accepting
conexions by ssh from the host that i dont want
i modify hosts.allow like this
sshd: 10.41.0.1 10.41.0.2
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.