{"id":4655,"date":"2018-09-14T14:11:21","date_gmt":"2018-09-14T14:11:21","guid":{"rendered":"https:\/\/www.inmotionhosting.com\/support\/2018\/09\/14\/ssh-blacklist-whitelist\/"},"modified":"2024-04-17T16:25:50","modified_gmt":"2024-04-17T20:25:50","slug":"blacklist-whitelist-ip-address-ssh","status":"publish","type":"post","link":"https:\/\/www.inmotionhosting.com\/support\/server\/ssh\/blacklist-whitelist-ip-address-ssh\/","title":{"rendered":"How to Blacklist\/Whitelist IP Address via SSH"},"content":{"rendered":"<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<div class=\"jetpack-video-wrapper\"><div class=\"yt-eqMMAbOcNrk\">\n\t<a class=\"play-video-eqMMAbOcNrk\" style=\"position: relative; display: flex; flex-wrap: wrap; align-items: center; cursor: pointer;\">\n\t\t<img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i.ytimg.com\/vi_webp\/eqMMAbOcNrk\/maxresdefault.webp\" width=\"1280\" height=\"720\" alt=\"How to Blacklist or Whitelist IP Addresses in Linux using SSH\" style=\"width: 100%; height: auto;\">\n\t\t<span class=\"fa fa-imh-play-circle imh-ds-icon play-circle\" style=\"position: absolute; display:block; font-size:150px; color: #c52228; opacity:0;\"><\/span>\n\t<\/a>\n<\/div><\/div>\n<\/div><\/figure>\n\n\n<p>As we continue our series on the <a href=\"\/support\/security\/enabling-cphulk\/\">cPHulk security<\/a> features, we will show you the steps to <b>blacklist and whitelist IP addresses via SSH<\/b>. In the last guide we showed you <a href=\"https:\/\/www.inmotionhosting.com\/support\/edu\/whm\/blacklist-whitelist-ip-address-whm\/\">how to blacklist and whitelist IP addresses in the Web Host Manager<\/a> or WHM. But doing this with command line using SSH can save time since you do not have to go through the WHM interface.<\/p>\n<div class=\"alert alert-warning\" role=\"alert\"><b>**Note:<\/b> You need <a href=\"\/support\/amp\/obtain-root-access\/\">root access<\/a> to your web hosting server before following this guide.<\/div>\n<p><a name=\"blacklist\"><\/a><\/p>\n<h2>Blacklist IP Address<\/h2>\n<ol class=\"article_list\">\n<li><a href=\"\/support\/server\/ssh\/how-to-login-ssh\/\">Connect to your server via SSH<\/a> as the \u2018root\u2019 user.\n<div style=\"clear: both;\">\u00a0<\/div>\n<\/li>\n<li>Run the following command, but be sure to replace the example IP address (123.45.67.89) with the address you want to blacklist.\n<p class=\"cli\"><span style=\"color: #00e000;\">\/scripts\/cphulkdblacklist 123.45.67.89<\/span><\/p>\n<p>You will then see a response similar to the following:<\/p>\n<p class=\"cli\">123.34.56.78 has been blacklisted<\/p>\n<div style=\"clear: both;\">\u00a0<\/div>\n<p>At this time the IP address has been blacklisted. repeat these steps for any IP addresses you want to blacklist.<\/p>\n<div style=\"clear: both;\">\u00a0<\/div>\n<\/li>\n<\/ol>\n<p>Now that you know how to blacklist an IP address via SSH, we will show you how to whitelist IP addresses.<\/p>\n<p><a name=\"whitelist\"><\/a><\/p>\n<h2>Whitelist IP Address<\/h2>\n<ol class=\"article_list\">\n<li><a href=\"\/support\/server\/ssh\/how-to-login-ssh\/\">Connect to your server via SSH<\/a> as the \u2018root\u2019 user.\n<div style=\"clear: both;\">\u00a0<\/div>\n<\/li>\n<li>Run the following command, but be sure to replace the example IP address (123.45.67.89) with the address you want to whitelist.\n<p class=\"cli\"><span style=\"color: #00e000;\">\/scripts\/cphulkdwhitelist 123.45.67.89<\/span><\/p>\n<p>You will then see a response similar to the following:<\/p>\n<p class=\"cli\">123.34.56.78 has been whitelisted<\/p>\n<div style=\"clear: both;\">\u00a0<\/div>\n<p>At this time the IP address has been whitelisted. repeat these steps for any IP addresses you want to whitelist.<\/p>\n<div style=\"clear: both;\">\u00a0<\/div>\n<\/li>\n<\/ol>\n<p>Congratulations, now you know how to whitelist and blacklist IP addresses via SSH!<\/p>\n\n\n<p class=\"alert alert-info\">Secure your websites with our <a rel=\"noopener noreferrer\" href=\"https:\/\/www.inmotionhosting.com\/dedicated-servers\" target=\"_blank\">Dedicated Server Hosting<\/a> and a hardware firewall today.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>As we continue our series on the cPHulk security features, we will show you the steps to blacklist and whitelist IP addresses via SSH. In the last guide we showed you how to blacklist and whitelist IP addresses in the Web Host Manager or WHM. But doing this with command line using SSH can save<a class=\"moretag\" href=\"https:\/\/www.inmotionhosting.com\/support\/server\/ssh\/blacklist-whitelist-ip-address-ssh\/\"> Read More ><\/a><\/p>\n","protected":false},"author":57014,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[4307],"tags":[],"class_list":["post-4655","post","type-post","status-publish","format-standard","hentry","category-ssh"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.1.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to Blacklist\/Whitelist IP Address via SSH<\/title>\n<meta name=\"description\" content=\"Learn how to blacklist and whitelist IP address with command line using SSH.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.inmotionhosting.com\/support\/server\/ssh\/blacklist-whitelist-ip-address-ssh\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Blacklist\/Whitelist IP Address via SSH\" \/>\n<meta property=\"og:description\" content=\"Learn how to blacklist and whitelist IP address with command line using SSH.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.inmotionhosting.com\/support\/server\/ssh\/blacklist-whitelist-ip-address-ssh\/\" \/>\n<meta property=\"og:site_name\" content=\"InMotion Hosting Support Center\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/inmotionhosting\/\" \/>\n<meta property=\"article:published_time\" content=\"2018-09-14T14:11:21+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-04-17T20:25:50+00:00\" \/>\n<meta name=\"author\" content=\"InMotion Hosting Contributor\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@https:\/\/twitter.com\/InMotionHosting\" \/>\n<meta name=\"twitter:site\" content=\"@InMotionHosting\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"InMotion Hosting Contributor\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/server\/ssh\/blacklist-whitelist-ip-address-ssh\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/server\/ssh\/blacklist-whitelist-ip-address-ssh\/\"},\"author\":{\"name\":\"InMotion Hosting Contributor\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/f9a4fc454cd1df128ee8e898d30d4644\"},\"headline\":\"How to Blacklist\/Whitelist IP Address via SSH\",\"datePublished\":\"2018-09-14T14:11:21+00:00\",\"dateModified\":\"2024-04-17T20:25:50+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/server\/ssh\/blacklist-whitelist-ip-address-ssh\/\"},\"wordCount\":276,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#organization\"},\"articleSection\":[\"SSH and Root Access\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.inmotionhosting.com\/support\/server\/ssh\/blacklist-whitelist-ip-address-ssh\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/server\/ssh\/blacklist-whitelist-ip-address-ssh\/\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/server\/ssh\/blacklist-whitelist-ip-address-ssh\/\",\"name\":\"How to Blacklist\/Whitelist IP Address via SSH\",\"isPartOf\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#website\"},\"datePublished\":\"2018-09-14T14:11:21+00:00\",\"dateModified\":\"2024-04-17T20:25:50+00:00\",\"description\":\"Learn how to blacklist and whitelist IP address with command line using SSH.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/server\/ssh\/blacklist-whitelist-ip-address-ssh\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.inmotionhosting.com\/support\/server\/ssh\/blacklist-whitelist-ip-address-ssh\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/server\/ssh\/blacklist-whitelist-ip-address-ssh\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.inmotionhosting.com\/support\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Blacklist\/Whitelist IP Address via SSH\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#website\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/\",\"name\":\"InMotion Hosting Support Center\",\"description\":\"Web Hosting Support &amp; Tutorials\",\"publisher\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.inmotionhosting.com\/support\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#organization\",\"name\":\"InMotion Hosting\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg\",\"contentUrl\":\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg\",\"width\":696,\"height\":696,\"caption\":\"InMotion Hosting\"},\"image\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/inmotionhosting\/\",\"https:\/\/x.com\/InMotionHosting\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/f9a4fc454cd1df128ee8e898d30d4644\",\"name\":\"InMotion Hosting Contributor\",\"description\":\"InMotion Hosting contributors are highly knowledgeable individuals who create relevant content on new trends and troubleshooting techniques to help you achieve your online goals!\",\"sameAs\":[\"https:\/\/www.linkedin.com\/company\/inmotion-hosting\/\",\"https:\/\/x.com\/https:\/\/twitter.com\/InMotionHosting\"],\"url\":\"https:\/\/www.inmotionhosting.com\/support\/author\/inmotion-hosting-contributor\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Blacklist\/Whitelist IP Address via SSH","description":"Learn how to blacklist and whitelist IP address with command line using SSH.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.inmotionhosting.com\/support\/server\/ssh\/blacklist-whitelist-ip-address-ssh\/","og_locale":"en_US","og_type":"article","og_title":"How to Blacklist\/Whitelist IP Address via SSH","og_description":"Learn how to blacklist and whitelist IP address with command line using SSH.","og_url":"https:\/\/www.inmotionhosting.com\/support\/server\/ssh\/blacklist-whitelist-ip-address-ssh\/","og_site_name":"InMotion Hosting Support Center","article_publisher":"https:\/\/www.facebook.com\/inmotionhosting\/","article_published_time":"2018-09-14T14:11:21+00:00","article_modified_time":"2024-04-17T20:25:50+00:00","author":"InMotion Hosting Contributor","twitter_card":"summary_large_image","twitter_creator":"@https:\/\/twitter.com\/InMotionHosting","twitter_site":"@InMotionHosting","twitter_misc":{"Written by":"InMotion Hosting Contributor","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.inmotionhosting.com\/support\/server\/ssh\/blacklist-whitelist-ip-address-ssh\/#article","isPartOf":{"@id":"https:\/\/www.inmotionhosting.com\/support\/server\/ssh\/blacklist-whitelist-ip-address-ssh\/"},"author":{"name":"InMotion Hosting Contributor","@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/f9a4fc454cd1df128ee8e898d30d4644"},"headline":"How to Blacklist\/Whitelist IP Address via SSH","datePublished":"2018-09-14T14:11:21+00:00","dateModified":"2024-04-17T20:25:50+00:00","mainEntityOfPage":{"@id":"https:\/\/www.inmotionhosting.com\/support\/server\/ssh\/blacklist-whitelist-ip-address-ssh\/"},"wordCount":276,"commentCount":0,"publisher":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#organization"},"articleSection":["SSH and Root Access"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.inmotionhosting.com\/support\/server\/ssh\/blacklist-whitelist-ip-address-ssh\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.inmotionhosting.com\/support\/server\/ssh\/blacklist-whitelist-ip-address-ssh\/","url":"https:\/\/www.inmotionhosting.com\/support\/server\/ssh\/blacklist-whitelist-ip-address-ssh\/","name":"How to Blacklist\/Whitelist IP Address via SSH","isPartOf":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#website"},"datePublished":"2018-09-14T14:11:21+00:00","dateModified":"2024-04-17T20:25:50+00:00","description":"Learn how to blacklist and whitelist IP address with command line using SSH.","breadcrumb":{"@id":"https:\/\/www.inmotionhosting.com\/support\/server\/ssh\/blacklist-whitelist-ip-address-ssh\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.inmotionhosting.com\/support\/server\/ssh\/blacklist-whitelist-ip-address-ssh\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.inmotionhosting.com\/support\/server\/ssh\/blacklist-whitelist-ip-address-ssh\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.inmotionhosting.com\/support\/"},{"@type":"ListItem","position":2,"name":"How to Blacklist\/Whitelist IP Address via SSH"}]},{"@type":"WebSite","@id":"https:\/\/www.inmotionhosting.com\/support\/#website","url":"https:\/\/www.inmotionhosting.com\/support\/","name":"InMotion Hosting Support Center","description":"Web Hosting Support &amp; Tutorials","publisher":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.inmotionhosting.com\/support\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.inmotionhosting.com\/support\/#organization","name":"InMotion Hosting","url":"https:\/\/www.inmotionhosting.com\/support\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/","url":"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg","contentUrl":"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg","width":696,"height":696,"caption":"InMotion Hosting"},"image":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/inmotionhosting\/","https:\/\/x.com\/InMotionHosting"]},{"@type":"Person","@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/f9a4fc454cd1df128ee8e898d30d4644","name":"InMotion Hosting Contributor","description":"InMotion Hosting contributors are highly knowledgeable individuals who create relevant content on new trends and troubleshooting techniques to help you achieve your online goals!","sameAs":["https:\/\/www.linkedin.com\/company\/inmotion-hosting\/","https:\/\/x.com\/https:\/\/twitter.com\/InMotionHosting"],"url":"https:\/\/www.inmotionhosting.com\/support\/author\/inmotion-hosting-contributor\/"}]}},"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"primary_category":null,"_links":{"self":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts\/4655","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/users\/57014"}],"replies":[{"embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/comments?post=4655"}],"version-history":[{"count":7,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts\/4655\/revisions"}],"predecessor-version":[{"id":127630,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts\/4655\/revisions\/127630"}],"wp:attachment":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/media?parent=4655"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/categories?post=4655"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/tags?post=4655"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}