{"id":1331,"date":"2016-07-14T18:44:20","date_gmt":"2016-07-14T18:44:20","guid":{"rendered":"http:\/\/www.incredigeek.com\/home\/?p=1331"},"modified":"2016-07-14T18:45:55","modified_gmt":"2016-07-14T18:45:55","slug":"allow-ssh-access-from-a-specific-host-using-hosts-allow-and-hosts-deny-on-linux","status":"publish","type":"post","link":"https:\/\/www.incredigeek.com\/home\/allow-ssh-access-from-a-specific-host-using-hosts-allow-and-hosts-deny-on-linux\/","title":{"rendered":"Allow SSH access from a specific host using hosts.allow and hosts.deny on Linux"},"content":{"rendered":"<p>This is just a quick write on the hosts.allow and deny files.\u00a0 You can lookup &#8220;spawn&#8221; and\/or &#8220;twist&#8221; for some advanced usage.<\/p>\n<p>&nbsp;<\/p>\n<p>So to limit an IP address, or a IP range access to SSH, do the following<\/p>\n<p>Deny all incoming request for SSH<\/p>\n<p>Edit the &#8220;hosts.deny&#8221; file<\/p>\n<pre>vi \/etc\/hosts.deny<\/pre>\n<p>add the following line<\/p>\n<pre>sshd : ALL<\/pre>\n<p>Now edit &#8220;hosts.allow&#8221; and allow the client IP, or IP range to access SSH<\/p>\n<pre>vi \/etc\/hosts.allow<\/pre>\n<p>add the following line to allow a single IP<\/p>\n<pre>sshd : 192.168.1.182<\/pre>\n<p>If you want to allow the whole subnet, then replace the above line with this one<\/p>\n<pre>sshd : 192.168.1.<\/pre>\n<p>hosts.allow overrides hosts.deny.\u00a0 So you deny everything and then allow exceptions.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This is just a quick write on the hosts.allow and deny files.\u00a0 You can lookup &#8220;spawn&#8221; and\/or &#8220;twist&#8221; for some advanced usage. &nbsp; So to limit an IP address, or a IP range access to SSH, do the following Deny &hellip; <a href=\"https:\/\/www.incredigeek.com\/home\/allow-ssh-access-from-a-specific-host-using-hosts-allow-and-hosts-deny-on-linux\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[23,4,264,24,3,21,22,28],"tags":[7,221,294],"class_list":["post-1331","post","type-post","status-publish","format-standard","hentry","category-centos-linux","category-command-line","category-debian","category-fedora-2","category-linux","category-networking","category-redhat-linux","category-ubuntu","tag-linux-2","tag-ssh","tag-sshd"],"_links":{"self":[{"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/posts\/1331","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/comments?post=1331"}],"version-history":[{"count":9,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/posts\/1331\/revisions"}],"predecessor-version":[{"id":1340,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/posts\/1331\/revisions\/1340"}],"wp:attachment":[{"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/media?parent=1331"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/categories?post=1331"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/tags?post=1331"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}