LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 08-29-2008, 04:55 PM   #1
caedo
LQ Newbie
 
Registered: Aug 2008
Posts: 5

Rep: Reputation: 0
how to allow and deny ssh acces to certain IPs


good day,


I need to be able to allow certain IPs ssh access to my server and deny the access to the rest of the incoming requests. I've seen that iptables is used to do this type of work, but it is a bit confusing, can you help me out?

I need only to grant access to the IPs I want and deny the access to the rest of IPs.

How can this be achieve?


thanks in advance


btw, im running centOS 5.2.


caedo
 
Old 08-29-2008, 06:03 PM   #2
estabroo
Senior Member
 
Registered: Jun 2008
Distribution: debian, ubuntu, sidux
Posts: 1,126
Blog Entries: 2

Rep: Reputation: 124Reputation: 124
Put in rules for accepting connections and then a rule to reject or drop.

iptables -A INPUT -p tcp -s ip_address1 --dport 22 -j ACCEPT
iptables -A INPUT -p tcp -s ip_address2 --dport 22 -j ACCEPT
iptables -A INPUT -p tcp --dport 22 -j REJECT --reject-with tcp-reset
 
Old 09-12-2008, 10:45 AM   #3
tarikacct
LQ Newbie
 
Registered: Aug 2008
Posts: 1

Rep: Reputation: 0
I just used it and works perfect. thanks estabroo.
 
Old 09-13-2008, 09:10 AM   #4
Micro420
Senior Member
 
Registered: Aug 2003
Location: Berkeley, CA
Distribution: Mac OS X Leopard 10.6.2, Windows 2003 Server/Vista/7/XP/2000/NT/98, Ubuntux64, CentOS4.8/5.4
Posts: 2,986

Rep: Reputation: 45
Another method is to edit your hosts.allow and hosts.deny.

Glad to see you are running the best distro!
 
Old 09-19-2008, 11:47 AM   #5
vikas027
Senior Member
 
Registered: May 2007
Location: Sydney
Distribution: RHEL, CentOS, Ubuntu, Debian, OS X
Posts: 1,305

Rep: Reputation: 107Reputation: 107
Question

Quote:
Originally Posted by Micro420 View Post
Another method is to edit your hosts.allow and hosts.deny.
Please give an example.

Regards,
VIKAS
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
SSH and VNC acces problems Fede.mac Linux - Networking 6 08-10-2008 04:01 PM
how to deny ssh for ip range? maginotjr Slackware 11 11-01-2005 07:01 AM
Controlling remote acces SSH Wimpie22 Linux - Security 9 07-27-2005 04:33 PM
no acces with ssh kvtournh Linux - Networking 3 12-11-2003 08:29 AM
How do i deny ips in apache?? vbp6us Linux - General 8 03-17-2003 09:02 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 10:49 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration