{"id":532,"date":"2022-09-03T00:44:49","date_gmt":"2022-09-03T06:44:49","guid":{"rendered":"https:\/\/rewaant.com\/blog\/?p=532"},"modified":"2022-09-13T10:14:38","modified_gmt":"2022-09-13T16:14:38","slug":"hardening-ssh-on-your-linux-server","status":"publish","type":"post","link":"https:\/\/rewaant.com\/blog\/hardening-ssh-on-your-linux-server\/","title":{"rendered":"Hardening SSH on your Linux server"},"content":{"rendered":"\n<h3 class=\"table-of-contents wp-block-heading\">Table of Contents<\/h3>\n\n\n\n<ol class=\"table-of-contents-list wp-block-list\"><li><a href=\"#overview\">Overview<\/a><\/li><li><a href=\"#setup-key-auth\">Setting up key-based authentication<\/a><\/li><li><a href=\"#disable-ipv6\">Disable the IPv6 access<\/a><\/li><li><a href=\"#disable-root\">Disable root login via SSH<\/a><\/li><li><a href=\"#setup-firewall\">Set up a firewall<\/a><\/li><li><a href=\"#setup-fail2ban\">Setting up Fail2Ban<\/a><\/li><\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">Overview<\/h2>\n\n\n\n<p>This guide covers important aspects of hardening SSH access for your production server so you can secure your resources against random brute-force login attempts.<\/p>\n\n\n\n<p>We\u2019ll be mainly covering these topics:<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>Use key-based authentication if you\u2019re still using passwords<\/li><li>Disable SSH access over IPv6<\/li><li>Disable root login via SSH<\/li><li>Disable password-based authentication once you can connect with your keys<\/li><li>Set up a firewall<\/li><li>Using Fail2Ban to ban IP addresses after too many login attempts<\/li><\/ol>\n\n\n\n<p>Let\u2019s get started!<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"setup-key-auth\">Setting up key-based authentication<\/h2>\n\n\n\n<p>If you\u2019re using a password to authenticate into your production server, we highly recommend using SSH keys which are more secure and convenient for managing servers. Follow the steps in this guide and you should be good to go: <a href=\"https:\/\/rewaant.com\/blog\/setup-ssh-keys-on-your-linux-server\/\" target=\"_blank\" rel=\"noreferrer noopener\">How to setup SSH keys on your Linux server<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"disable-ipv6\">Disable the IPv6 access<\/h2>\n\n\n\n<p>IPv6 is a newer protocol compared to IPv4, but for most users out there, it\u2019s likely they won\u2019t be needing it presently. For enhancing security, we\u2019ll disable SSH access over IPv6.<\/p>\n\n\n\n<p>Connect to your instance with a less privileged user you\u2019ve set up previously. Do not proceed if you just have the root user&#8217;s credentials.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"545\" src=\"https:\/\/rewaant.com\/blog\/wp-content\/uploads\/2022\/09\/1-1-1024x545.png\" alt=\"\" class=\"wp-image-538\" srcset=\"https:\/\/rewaant.com\/blog\/wp-content\/uploads\/2022\/09\/1-1-980x522.png 980w, https:\/\/rewaant.com\/blog\/wp-content\/uploads\/2022\/09\/1-1-480x256.png 480w\" sizes=\"(min-width: 0px) and (max-width: 480px) 480px, (min-width: 481px) and (max-width: 980px) 980px, (min-width: 981px) 1024px, 100vw\" \/><\/figure>\n\n\n\n<p>Once connected, type in the command: <em>sudo nano \/etc\/ssh\/sshd_config <\/em>. This should ask for your user&#8217;s password. Once you have access to the file, navigate with the arrow keys to line with the following text:<\/p>\n\n\n\n<p><code>#Port 22 <\/code><br><code>#AddressFamily any<\/code><\/p>\n\n\n\n<p>It\u2019ll most likely be on top of the file with the configuration commented out, make sure this is set to:<\/p>\n\n\n\n<p><code>#Port 22 <\/code><br><code>AddressFamily inet<\/code><\/p>\n\n\n\n<p>This should allow access only over IPv4 connections.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"545\" src=\"https:\/\/rewaant.com\/blog\/wp-content\/uploads\/2022\/09\/2-1-1024x545.png\" alt=\"\" class=\"wp-image-539\" srcset=\"https:\/\/rewaant.com\/blog\/wp-content\/uploads\/2022\/09\/2-1-980x522.png 980w, https:\/\/rewaant.com\/blog\/wp-content\/uploads\/2022\/09\/2-1-480x256.png 480w\" sizes=\"(min-width: 0px) and (max-width: 480px) 480px, (min-width: 481px) and (max-width: 980px) 980px, (min-width: 981px) 1024px, 100vw\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"disable-root\">Disable root login via SSH<\/h2>\n\n\n\n<p>Next, we\u2019ll disable the root user to log in via SSH. \u201croot\u201d is a superuser with the highest administrative privileges that in the wrong\/incompetent hands can wreak havoc in the system. Also, most brute-force login attempts target the root user so it\u2019s important to disable this user for SSH entirely. It\u2019s important to make sure that you have a less privileged user already set up on your system with sudo capabilities. You should also know the password to this less privileged user account or you may risk locking yourself out of the system entirely.<\/p>\n\n\n\n<p>PermitRootLogin yes Change this line to <em>PermitRootLogin no<\/em><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"545\" src=\"https:\/\/rewaant.com\/blog\/wp-content\/uploads\/2022\/09\/3-1-1024x545.png\" alt=\"\" class=\"wp-image-540\" srcset=\"https:\/\/rewaant.com\/blog\/wp-content\/uploads\/2022\/09\/3-1-980x522.png 980w, https:\/\/rewaant.com\/blog\/wp-content\/uploads\/2022\/09\/3-1-480x256.png 480w\" sizes=\"(min-width: 0px) and (max-width: 480px) 480px, (min-width: 481px) and (max-width: 980px) 980px, (min-width: 981px) 1024px, 100vw\" \/><\/figure>\n\n\n\n<p>We now have to write these changes to disk. Assuming you\u2019re using the nano text editor, execute the following commands: <em>Ctrl+O<\/em> or <em>Cmd+O<\/em> to write changes to the file. This will confirm the filename, leave it to default, and DO NOT CHANGE. Press <em>Ctrl+X<\/em> or <em>Cmd+X<\/em> to exit the nano text editor.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"2032\" height=\"1082\" src=\"https:\/\/rewaant.com\/blog\/wp-content\/uploads\/2022\/09\/5-1024x545.png\" alt=\"\" class=\"wp-image-541\" srcset=\"https:\/\/rewaant.com\/blog\/wp-content\/uploads\/2022\/09\/5-1024x545.png 2032w, https:\/\/rewaant.com\/blog\/wp-content\/uploads\/2022\/09\/5-1280x682.png 1280w, https:\/\/rewaant.com\/blog\/wp-content\/uploads\/2022\/09\/5-980x522.png 980w, https:\/\/rewaant.com\/blog\/wp-content\/uploads\/2022\/09\/5-480x256.png 480w\" sizes=\"(min-width: 0px) and (max-width: 480px) 480px, (min-width: 481px) and (max-width: 980px) 980px, (min-width: 981px) and (max-width: 1280px) 1280px, (min-width: 1281px) 2032px, 100vw\" \/><\/figure>\n\n\n\n<p>Now we need to restart the SSH service to make these changes active. Execute the command: <em>sudo systemctl restart sshd<\/em> This will restart the SSH service.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"545\" src=\"https:\/\/rewaant.com\/blog\/wp-content\/uploads\/2022\/09\/6-1-1024x545.png\" alt=\"\" class=\"wp-image-542\" srcset=\"https:\/\/rewaant.com\/blog\/wp-content\/uploads\/2022\/09\/6-1-980x522.png 980w, https:\/\/rewaant.com\/blog\/wp-content\/uploads\/2022\/09\/6-1-480x256.png 480w\" sizes=\"(min-width: 0px) and (max-width: 480px) 480px, (min-width: 481px) and (max-width: 980px) 980px, (min-width: 981px) 1024px, 100vw\" \/><\/figure>\n\n\n\n<p><strong>Important:<\/strong> If at any point during or after this tutorial, you get locked out of your system, you can always fall back to using your cloud provider&#8217;s web console. They\u2019re handy when things go awry.<\/p>\n\n\n\n<p>Let&#8217;s continue to the next section and set up a firewall.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"setup-firewall\">Set up a firewall<\/h2>\n\n\n\n<p>We\u2019ll be using ufw in this guide which stands for <span style=\"text-decoration: underline;\">Uncomplicated Firewall<\/span>. This firewall program is simple to set up and more than enough for most use cases out there. To get started, let&#8217;s check if we have it pre-installed:<\/p>\n\n\n\n<p>Execute the command: <em>sudo apt install ufw<\/em> You should see a similar output below.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"545\" src=\"https:\/\/rewaant.com\/blog\/wp-content\/uploads\/2022\/09\/7-1-1024x545.png\" alt=\"\" class=\"wp-image-543\" srcset=\"https:\/\/rewaant.com\/blog\/wp-content\/uploads\/2022\/09\/7-1-980x522.png 980w, https:\/\/rewaant.com\/blog\/wp-content\/uploads\/2022\/09\/7-1-480x256.png 480w\" sizes=\"(min-width: 0px) and (max-width: 480px) 480px, (min-width: 481px) and (max-width: 980px) 980px, (min-width: 981px) 1024px, 100vw\" \/><\/figure>\n\n\n\n<p>Once it\u2019s installed, we can enable\/disable rules under ufw. For our use case with SSH and opening up the usual HTTP (80) and HTTPS (443) ports, we\u2019ll execute the following commands:<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li><em><code>sudo ufw allow ssh<\/code><\/em><\/li><li><em><code>sudo ufw allow 80\/tcp<\/code><\/em><\/li><li><em><code>sudo ufw allow 443\/tcp<\/code><\/em><\/li><\/ol>\n\n\n\n<p>You should see a similar output below.<\/p>\n\n\n\n<p>Now that we\u2019ve allowed the basic ports with firewall, we\u2019ll enable it with the command sudo ufw enable. Do not enable ufw without allowing ssh or port 22 as it\u2019s likely you WILL get locked out of your system.<\/p>\n\n\n\n<p>Check the firewall status with <em>sudo ufw status<\/em>. This should have similar output with Status: active and the rules printed out below.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"545\" src=\"https:\/\/rewaant.com\/blog\/wp-content\/uploads\/2022\/09\/8-1-1024x545.png\" alt=\"\" class=\"wp-image-544\" srcset=\"https:\/\/rewaant.com\/blog\/wp-content\/uploads\/2022\/09\/8-1-980x522.png 980w, https:\/\/rewaant.com\/blog\/wp-content\/uploads\/2022\/09\/8-1-480x256.png 480w\" sizes=\"(min-width: 0px) and (max-width: 480px) 480px, (min-width: 481px) and (max-width: 980px) 980px, (min-width: 981px) 1024px, 100vw\" \/><\/figure>\n\n\n\n<p>We now have the firewall setup, we\u2019ll proceed to the next and final step.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"setup-fail2ban\">Setting up Fail2Ban<\/h2>\n\n\n\n<p>Fail2Ban is another utility that prevents your server from brute-force attacks. It\u2019s likely that authenticated users will be able to access your server with 3 or lesser tries. This utility will ban IP addresses used by hackers and bots which may try to break into our systems using brute-force attacks.<\/p>\n\n\n\n<p>Install Fail2Ban with <em>sudo apt install fail2ban<\/em><\/p>\n\n\n\n<p>Enable the fail2ban service with the command <em>sudo systemctl enable fail2ban<\/em> this will create a systemd service for fail2ban.<\/p>\n\n\n\n<p>We\u2019ll keep the fail2ban configuration to default for simplicity. However, we intend on writing a comprehensive guide for fail2ban later. To start the service, use <em>sudo systemctl start fail2ban<\/em>.<\/p>\n\n\n\n<p>We\u2019ll now check the service status. Type in <em>sudo systemctl status fail2ban<\/em> and you should see similar output.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"588\" src=\"https:\/\/rewaant.com\/blog\/wp-content\/uploads\/2022\/09\/9-1-1024x588.png\" alt=\"\" class=\"wp-image-545\" srcset=\"https:\/\/rewaant.com\/blog\/wp-content\/uploads\/2022\/09\/9-1-980x563.png 980w, https:\/\/rewaant.com\/blog\/wp-content\/uploads\/2022\/09\/9-1-480x276.png 480w\" sizes=\"(min-width: 0px) and (max-width: 480px) 480px, (min-width: 481px) and (max-width: 980px) 980px, (min-width: 981px) 1024px, 100vw\" \/><\/figure>\n\n\n\n<p>You now have Fail2Ban active and running on your server.<\/p>\n\n\n\n<p>This guide helps you tighten security on your production server by hardening SSH access. Following this guide keeps your resources more secure than most production servers out there. In the end, no matter how many security measures we take it\u2019s always better when solutions are customized specifically to our needs. We recommend you read more on these topics or feel free to reach out to schedule an intro call so we can help you with setting up your sites or app\u2019s infrastructure properly.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Simple guide to securing SSH access to your linux server.<\/p>\n<p>Setting up SSH keys, disabling IPv6 access, changing default SSH port, disabling root login, how to setup basic rules with firewall and more.<\/p>\n","protected":false},"author":1,"featured_media":685,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_et_pb_use_builder":"off","_et_pb_old_content":"","_et_gb_content_width":"","inline_featured_image":false,"footnotes":""},"categories":[18],"tags":[],"class_list":["post-532","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server-admin"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Hardening SSH on your Linux server - Rewaant | Blog | Web &amp; Mobile Dev Tidbits<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/rewaant.com\/blog\/hardening-ssh-on-your-linux-server\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Hardening SSH on your Linux server - Rewaant | Blog | Web &amp; Mobile Dev Tidbits\" \/>\n<meta property=\"og:description\" content=\"Simple guide to securing SSH access to your linux server. Setting up SSH keys, disabling IPv6 access, changing default SSH port, disabling root login, how to setup basic rules with firewall and more.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/rewaant.com\/blog\/hardening-ssh-on-your-linux-server\/\" \/>\n<meta property=\"og:site_name\" content=\"Rewaant | Blog | Web &amp; Mobile Dev Tidbits\" \/>\n<meta property=\"article:published_time\" content=\"2022-09-03T06:44:49+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-09-13T16:14:38+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/rewaant.com\/blog\/wp-content\/uploads\/2022\/09\/securing_ssh_linux_server-1.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1024\" \/>\n\t<meta property=\"og:image:height\" content=\"588\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Rewaant Chhabra\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@rewaantllc\" \/>\n<meta name=\"twitter:site\" content=\"@rewaantllc\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Rewaant Chhabra\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/rewaant.com\\\/blog\\\/hardening-ssh-on-your-linux-server\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/rewaant.com\\\/blog\\\/hardening-ssh-on-your-linux-server\\\/\"},\"author\":{\"name\":\"Rewaant Chhabra\",\"@id\":\"https:\\\/\\\/rewaant.com\\\/blog\\\/#\\\/schema\\\/person\\\/ba855e29fc3aef528547d8cc5d574754\"},\"headline\":\"Hardening SSH on your Linux server\",\"datePublished\":\"2022-09-03T06:44:49+00:00\",\"dateModified\":\"2022-09-13T16:14:38+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/rewaant.com\\\/blog\\\/hardening-ssh-on-your-linux-server\\\/\"},\"wordCount\":951,\"publisher\":{\"@id\":\"https:\\\/\\\/rewaant.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/rewaant.com\\\/blog\\\/hardening-ssh-on-your-linux-server\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/rewaant.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/09\\\/securing_ssh_linux_server-1.png\",\"articleSection\":[\"Server Administration\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/rewaant.com\\\/blog\\\/hardening-ssh-on-your-linux-server\\\/\",\"url\":\"https:\\\/\\\/rewaant.com\\\/blog\\\/hardening-ssh-on-your-linux-server\\\/\",\"name\":\"Hardening SSH on your Linux server - Rewaant | Blog | Web &amp; Mobile Dev Tidbits\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/rewaant.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/rewaant.com\\\/blog\\\/hardening-ssh-on-your-linux-server\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/rewaant.com\\\/blog\\\/hardening-ssh-on-your-linux-server\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/rewaant.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/09\\\/securing_ssh_linux_server-1.png\",\"datePublished\":\"2022-09-03T06:44:49+00:00\",\"dateModified\":\"2022-09-13T16:14:38+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/rewaant.com\\\/blog\\\/hardening-ssh-on-your-linux-server\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/rewaant.com\\\/blog\\\/hardening-ssh-on-your-linux-server\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/rewaant.com\\\/blog\\\/hardening-ssh-on-your-linux-server\\\/#primaryimage\",\"url\":\"https:\\\/\\\/rewaant.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/09\\\/securing_ssh_linux_server-1.png\",\"contentUrl\":\"https:\\\/\\\/rewaant.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/09\\\/securing_ssh_linux_server-1.png\",\"width\":1024,\"height\":588},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/rewaant.com\\\/blog\\\/hardening-ssh-on-your-linux-server\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/rewaant.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Hardening SSH on your Linux server\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/rewaant.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/rewaant.com\\\/blog\\\/\",\"name\":\"Rewaant | Blog | Web &amp; Mobile Dev Tidbits\",\"description\":\"Web &amp; Mobile Dev Tidbits\",\"publisher\":{\"@id\":\"https:\\\/\\\/rewaant.com\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/rewaant.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/rewaant.com\\\/blog\\\/#organization\",\"name\":\"Rewaant | Blog | Web &amp; Mobile Dev Tidbits\",\"url\":\"https:\\\/\\\/rewaant.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/rewaant.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/rewaant.com\\\/blog\\\/wp-content\\\/uploads\\\/2021\\\/09\\\/rewaant_logo.png\",\"contentUrl\":\"https:\\\/\\\/rewaant.com\\\/blog\\\/wp-content\\\/uploads\\\/2021\\\/09\\\/rewaant_logo.png\",\"width\":544,\"height\":544,\"caption\":\"Rewaant | Blog | Web &amp; Mobile Dev Tidbits\"},\"image\":{\"@id\":\"https:\\\/\\\/rewaant.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/x.com\\\/rewaantllc\",\"https:\\\/\\\/www.linkedin.com\\\/company\\\/rewaantllc\\\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/rewaant.com\\\/blog\\\/#\\\/schema\\\/person\\\/ba855e29fc3aef528547d8cc5d574754\",\"name\":\"Rewaant Chhabra\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/a0645ed92498626e9f50d57143ac2213945fe137a73a9885e4f7e7199015b8bf?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/a0645ed92498626e9f50d57143ac2213945fe137a73a9885e4f7e7199015b8bf?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/a0645ed92498626e9f50d57143ac2213945fe137a73a9885e4f7e7199015b8bf?s=96&d=mm&r=g\",\"caption\":\"Rewaant Chhabra\"},\"sameAs\":[\"https:\\\/\\\/rewaant.com\\\/blog\"],\"url\":\"https:\\\/\\\/rewaant.com\\\/blog\\\/author\\\/rewaant\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Hardening SSH on your Linux server - Rewaant | Blog | Web &amp; Mobile Dev Tidbits","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:\/\/rewaant.com\/blog\/hardening-ssh-on-your-linux-server\/","og_locale":"en_US","og_type":"article","og_title":"Hardening SSH on your Linux server - Rewaant | Blog | Web &amp; Mobile Dev Tidbits","og_description":"Simple guide to securing SSH access to your linux server. Setting up SSH keys, disabling IPv6 access, changing default SSH port, disabling root login, how to setup basic rules with firewall and more.","og_url":"https:\/\/rewaant.com\/blog\/hardening-ssh-on-your-linux-server\/","og_site_name":"Rewaant | Blog | Web &amp; Mobile Dev Tidbits","article_published_time":"2022-09-03T06:44:49+00:00","article_modified_time":"2022-09-13T16:14:38+00:00","og_image":[{"width":1024,"height":588,"url":"https:\/\/rewaant.com\/blog\/wp-content\/uploads\/2022\/09\/securing_ssh_linux_server-1.png","type":"image\/png"}],"author":"Rewaant Chhabra","twitter_card":"summary_large_image","twitter_creator":"@rewaantllc","twitter_site":"@rewaantllc","twitter_misc":{"Written by":"Rewaant Chhabra","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/rewaant.com\/blog\/hardening-ssh-on-your-linux-server\/#article","isPartOf":{"@id":"https:\/\/rewaant.com\/blog\/hardening-ssh-on-your-linux-server\/"},"author":{"name":"Rewaant Chhabra","@id":"https:\/\/rewaant.com\/blog\/#\/schema\/person\/ba855e29fc3aef528547d8cc5d574754"},"headline":"Hardening SSH on your Linux server","datePublished":"2022-09-03T06:44:49+00:00","dateModified":"2022-09-13T16:14:38+00:00","mainEntityOfPage":{"@id":"https:\/\/rewaant.com\/blog\/hardening-ssh-on-your-linux-server\/"},"wordCount":951,"publisher":{"@id":"https:\/\/rewaant.com\/blog\/#organization"},"image":{"@id":"https:\/\/rewaant.com\/blog\/hardening-ssh-on-your-linux-server\/#primaryimage"},"thumbnailUrl":"https:\/\/rewaant.com\/blog\/wp-content\/uploads\/2022\/09\/securing_ssh_linux_server-1.png","articleSection":["Server Administration"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/rewaant.com\/blog\/hardening-ssh-on-your-linux-server\/","url":"https:\/\/rewaant.com\/blog\/hardening-ssh-on-your-linux-server\/","name":"Hardening SSH on your Linux server - Rewaant | Blog | Web &amp; Mobile Dev Tidbits","isPartOf":{"@id":"https:\/\/rewaant.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/rewaant.com\/blog\/hardening-ssh-on-your-linux-server\/#primaryimage"},"image":{"@id":"https:\/\/rewaant.com\/blog\/hardening-ssh-on-your-linux-server\/#primaryimage"},"thumbnailUrl":"https:\/\/rewaant.com\/blog\/wp-content\/uploads\/2022\/09\/securing_ssh_linux_server-1.png","datePublished":"2022-09-03T06:44:49+00:00","dateModified":"2022-09-13T16:14:38+00:00","breadcrumb":{"@id":"https:\/\/rewaant.com\/blog\/hardening-ssh-on-your-linux-server\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/rewaant.com\/blog\/hardening-ssh-on-your-linux-server\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/rewaant.com\/blog\/hardening-ssh-on-your-linux-server\/#primaryimage","url":"https:\/\/rewaant.com\/blog\/wp-content\/uploads\/2022\/09\/securing_ssh_linux_server-1.png","contentUrl":"https:\/\/rewaant.com\/blog\/wp-content\/uploads\/2022\/09\/securing_ssh_linux_server-1.png","width":1024,"height":588},{"@type":"BreadcrumbList","@id":"https:\/\/rewaant.com\/blog\/hardening-ssh-on-your-linux-server\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/rewaant.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Hardening SSH on your Linux server"}]},{"@type":"WebSite","@id":"https:\/\/rewaant.com\/blog\/#website","url":"https:\/\/rewaant.com\/blog\/","name":"Rewaant | Blog | Web &amp; Mobile Dev Tidbits","description":"Web &amp; Mobile Dev Tidbits","publisher":{"@id":"https:\/\/rewaant.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/rewaant.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/rewaant.com\/blog\/#organization","name":"Rewaant | Blog | Web &amp; Mobile Dev Tidbits","url":"https:\/\/rewaant.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/rewaant.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/rewaant.com\/blog\/wp-content\/uploads\/2021\/09\/rewaant_logo.png","contentUrl":"https:\/\/rewaant.com\/blog\/wp-content\/uploads\/2021\/09\/rewaant_logo.png","width":544,"height":544,"caption":"Rewaant | Blog | Web &amp; Mobile Dev Tidbits"},"image":{"@id":"https:\/\/rewaant.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/x.com\/rewaantllc","https:\/\/www.linkedin.com\/company\/rewaantllc\/"]},{"@type":"Person","@id":"https:\/\/rewaant.com\/blog\/#\/schema\/person\/ba855e29fc3aef528547d8cc5d574754","name":"Rewaant Chhabra","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/a0645ed92498626e9f50d57143ac2213945fe137a73a9885e4f7e7199015b8bf?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/a0645ed92498626e9f50d57143ac2213945fe137a73a9885e4f7e7199015b8bf?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/a0645ed92498626e9f50d57143ac2213945fe137a73a9885e4f7e7199015b8bf?s=96&d=mm&r=g","caption":"Rewaant Chhabra"},"sameAs":["https:\/\/rewaant.com\/blog"],"url":"https:\/\/rewaant.com\/blog\/author\/rewaant\/"}]}},"_links":{"self":[{"href":"https:\/\/rewaant.com\/blog\/wp-json\/wp\/v2\/posts\/532","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/rewaant.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/rewaant.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/rewaant.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/rewaant.com\/blog\/wp-json\/wp\/v2\/comments?post=532"}],"version-history":[{"count":8,"href":"https:\/\/rewaant.com\/blog\/wp-json\/wp\/v2\/posts\/532\/revisions"}],"predecessor-version":[{"id":710,"href":"https:\/\/rewaant.com\/blog\/wp-json\/wp\/v2\/posts\/532\/revisions\/710"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/rewaant.com\/blog\/wp-json\/wp\/v2\/media\/685"}],"wp:attachment":[{"href":"https:\/\/rewaant.com\/blog\/wp-json\/wp\/v2\/media?parent=532"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/rewaant.com\/blog\/wp-json\/wp\/v2\/categories?post=532"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/rewaant.com\/blog\/wp-json\/wp\/v2\/tags?post=532"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}