Register a domain and help support LQ
Go Back > Forums > Linux Forums > Linux - Security
User Name
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.


  Search this Thread
Old 12-25-2003, 01:06 AM   #1
Registered: Sep 2003
Distribution: SuSE 10
Posts: 55

Rep: Reputation: 15
Allow SSH from specific IP's ONLY.

Where can I specify the IP of the PC that will be logging in via ssh?
Old 12-25-2003, 01:29 AM   #2
Senior Member
Registered: Jul 2003
Location: Silicon Valley, USA
Distribution: OpenBSD 4.6, OS X 10.6.2, CentOS 4 & 5
Posts: 3,660

Rep: Reputation: 69
Edit /etc/hosts.allow

You should also block all inbound traffic to port 22 with iptables, and make a special allow rule just for the IP (src you want to allow. Of course, replace with your actual IP.
Old 12-29-2003, 03:43 AM   #3
Registered: Nov 2003
Distribution: xubuntu
Posts: 217

Rep: Reputation: 30
What if your IP is semi-dynamic? That is, mine changes every 3 weeks or so. Sometimes every week, or month. Kind of random. Though, the changes only involve the last 2 octets.

Anyway to restrict it based on hostname?
Old 12-29-2003, 04:02 AM   #4
Senior Member
Registered: Mar 2003
Distribution: Fedora
Posts: 3,658

Rep: Reputation: 65
You can use tcpwrappers to restrict based on partial IPs, like :
SSHD: 123.456.

It can also restrict by hostname as well. So if you got a completely differnt IP you could still use:

SSHD: or just


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 won't connect from outside IP's surfduke Mandriva 8 12-28-2004 10:36 PM
stopping specific ip's from accessing apache lawadm1 Linux - Software 7 09-26-2004 02:40 PM
How to lock out ip's that try to ssh by force mazzo Linux - Security 3 08-19-2004 02:28 PM
Need program to find specific IP's from a list cjdock Programming 20 12-17-2003 09:08 AM
Allow only specific IP's to log to FTP server ganninu Linux - Security 5 12-11-2003 07:26 AM

All times are GMT -5. The time now is 12:09 AM.

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