{"id":2820,"date":"2020-02-05T17:38:43","date_gmt":"2020-02-05T17:38:43","guid":{"rendered":"https:\/\/lamp.ciscoar.com\/?page_id=2820"},"modified":"2020-02-05T21:33:39","modified_gmt":"2020-02-05T21:33:39","slug":"ssh-global-settings","status":"publish","type":"page","link":"https:\/\/lamp.ciscoar.com\/?page_id=2820","title":{"rendered":"SSH Global Settings"},"content":{"rendered":"\n\n\n<h2 class=\"wp-block-heading\">SSH Global Settings file<\/h2>\n\n\n\n<p>As you probably know all the SSH related settings are inside one particular text file called &#8220;<strong>sshd_config<\/strong>&#8221; and that file is located in the following directory.<\/p>\n\n\n<p class=\"fonts-plugin-block \" style=\"font-family: calibri;font-weight: 700;font-size: 20px;color: #9b51e0\">\/etc\/ssh<\/p>\n\n\n<p>The following image clearly shows a typical Linux&#8217;s folder structure for you to see where the SSH global settings file is located.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><a href=\"https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2020\/02\/linux-centos7-ssh-global-settings.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"946\" height=\"596\" src=\"https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2020\/02\/linux-centos7-ssh-global-settings.jpg\" alt=\"\" class=\"wp-image-2825\" srcset=\"https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2020\/02\/linux-centos7-ssh-global-settings.jpg 946w, https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2020\/02\/linux-centos7-ssh-global-settings-300x189.jpg 300w, https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2020\/02\/linux-centos7-ssh-global-settings-768x484.jpg 768w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/a><figcaption>SSH global config file location<\/figcaption><\/figure><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">How to know it actually is a text file?<\/h2>\n\n\n\n<p>One of the natural questions that may arise when working on Linux machines is how to know beforehand if a file that I want to open is actually a file that I&#8217;m going to be able to open, as for example a text file and not a binary file (machine&#8217;s language)which content is not human readable.<\/p>\n\n\n\n<p>If you want to know which type of file you are dealing with you can use the &#8220;file&#8221; command, as follow.<\/p>\n\n\n<p class=\"fonts-plugin-block \" style=\"font-family: calibri;font-weight: 700;font-size: 20px;color: #9b51e0\">file sshd_config<\/p>\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><a href=\"https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2020\/02\/linux-centos7-how-to-know-the-type-of-file.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"421\" height=\"161\" src=\"https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2020\/02\/linux-centos7-how-to-know-the-type-of-file.jpg\" alt=\"\" class=\"wp-image-2873\" srcset=\"https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2020\/02\/linux-centos7-how-to-know-the-type-of-file.jpg 421w, https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2020\/02\/linux-centos7-how-to-know-the-type-of-file-300x115.jpg 300w\" sizes=\"auto, (max-width: 421px) 100vw, 421px\" \/><\/a><\/figure><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Opening the Global SSH configuration file<\/h2>\n\n\n\n<p>Those of you who are CLI\/terminal fans will prefer to open this file using, let&#8217;s say, &#8220;vi&#8221;, &#8220;nano&#8221;, etc. and that&#8217;s perfectly fine, in our case we are going to take advantage of the GUI provided by WinSCP.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"940\" height=\"696\" src=\"https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2020\/02\/linux-centos7-opening-ssh-global-settings-using-winscp.gif\" alt=\"\" class=\"wp-image-2840\"\/><figcaption>Opening the Global SSH settings file using WinSCP<\/figcaption><\/figure>\n\n\n\n<p>The preceding animation shows how easy is to open a text file using the GUI provided by WinSCP, it is just a matter of finding the file and double clicking over it, one important thing to mention is that we&#8217;ve used a WinSCP bookmark to accelerate to finding of the file, you can take a look at <a href=\"\/winscp-bookmarks\/\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"this article (opens in a new tab)\">this article<\/a> to learn how to create a WinSCP bookmark.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Important settings to know about<\/h2>\n\n\n\n<p>The &#8220;<strong>sshd_config<\/strong>&#8221; file is packed with much ssh settings, it would be impossible to cover each one of them, what we&#8217;re going to do instead is to just mention and discuss the ones we consider as the most relevant for our LAB and also future real life scenario, the following image show all of them.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><a href=\"https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2020\/01\/sshd_config-global-parameters.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"268\" src=\"https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2020\/01\/sshd_config-global-parameters-1024x268.png\" alt=\"\" class=\"wp-image-1945\" srcset=\"https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2020\/01\/sshd_config-global-parameters-1024x268.png 1024w, https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2020\/01\/sshd_config-global-parameters-300x78.png 300w, https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2020\/01\/sshd_config-global-parameters-768x201.png 768w, https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2020\/01\/sshd_config-global-parameters.png 1395w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/a><\/figure><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">SSH port number<\/h2>\n\n\n\n<p>For a LAB environment we can leave the port number as it is by default, that is port number 22, for a real life scenario you may want to change this number for security reason, in that case the only thing to do is to remove the &#8220;#&#8221; symbol (which tell the system this line must be considered as a comment) and change the port number.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><a href=\"https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2020\/02\/linux-centos7-ssh-global-settings-01-port-number.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"610\" height=\"321\" src=\"https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2020\/02\/linux-centos7-ssh-global-settings-01-port-number.jpg\" alt=\"\" class=\"wp-image-2848\" srcset=\"https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2020\/02\/linux-centos7-ssh-global-settings-01-port-number.jpg 610w, https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2020\/02\/linux-centos7-ssh-global-settings-01-port-number-300x158.jpg 300w\" sizes=\"auto, (max-width: 610px) 100vw, 610px\" \/><\/a><\/figure><\/div>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>For RedHat based systems (like CentOS) If you want to change the port do not forget to set SELinux accordingly.<\/p><\/blockquote>\n\n\n\n<h2 class=\"wp-block-heading\">SSH root login<\/h2>\n\n\n\n<p>Root account login is not a good practice on real life scenarios, but you can perfectly allow the root account to be able to login on your LAB, in order to do that be sure to remove the &#8220;#&#8221; symbol and type the word &#8220;yes&#8221;.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><a href=\"https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2020\/02\/linux-centos7-ssh-global-settings-02-root-login.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"557\" height=\"302\" src=\"https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2020\/02\/linux-centos7-ssh-global-settings-02-root-login.jpg\" alt=\"\" class=\"wp-image-2851\" srcset=\"https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2020\/02\/linux-centos7-ssh-global-settings-02-root-login.jpg 557w, https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2020\/02\/linux-centos7-ssh-global-settings-02-root-login-300x163.jpg 300w\" sizes=\"auto, (max-width: 557px) 100vw, 557px\" \/><\/a><\/figure><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">SSH PubkeyAuthentication<\/h2>\n\n\n\n<p>Those of you who want to enable <a href=\"\/ssh-public-and-private-keys\/#Public_key_authentication\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"Public Key Authentication (opens in a new tab)\">Public Key Authentication<\/a> as a valid authentication method, must change this parameter accordingly.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><a href=\"https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2020\/02\/linux-centos7-ssh-global-settings-03-pubkeyauth.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"557\" height=\"286\" src=\"https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2020\/02\/linux-centos7-ssh-global-settings-03-pubkeyauth.jpg\" alt=\"\" class=\"wp-image-2855\" srcset=\"https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2020\/02\/linux-centos7-ssh-global-settings-03-pubkeyauth.jpg 557w, https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2020\/02\/linux-centos7-ssh-global-settings-03-pubkeyauth-300x154.jpg 300w\" sizes=\"auto, (max-width: 557px) 100vw, 557px\" \/><\/a><\/figure><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">SSH AuthorizedKeysFile<\/h2>\n\n\n\n<p>The <strong>Authorized Keys File<\/strong> parameter tells the system where is located (on which directory) and what is the name of the file containing all the authorized keys (public keys).<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><a href=\"https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2020\/02\/linux-centos7-ssh-global-settings-04-authkeyfile.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"554\" height=\"227\" src=\"https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2020\/02\/linux-centos7-ssh-global-settings-04-authkeyfile.jpg\" alt=\"\" class=\"wp-image-2858\" srcset=\"https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2020\/02\/linux-centos7-ssh-global-settings-04-authkeyfile.jpg 554w, https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2020\/02\/linux-centos7-ssh-global-settings-04-authkeyfile-300x123.jpg 300w\" sizes=\"auto, (max-width: 554px) 100vw, 554px\" \/><\/a><figcaption>SSH authorized keys file<\/figcaption><\/figure><\/div>\n\n\n\n<p>As you can see in the preceding image the name of the file containing all the authorized keys is &#8220;<strong>authorized_keys<\/strong>&#8221; and the default folder is called &#8220;<strong>.ssh<\/strong>&#8221; located in the user&#8217;s home directory (%h).<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">SSH PasswordAuthentication<\/h2>\n\n\n\n<p>Most of the times, in real world scenarios you want to disable the password authentication method, once you&#8217;re using the <a href=\"\/ssh-public-and-private-keys\/#Public_key_authentication\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"Public Key Authentication (opens in a new tab)\">Public Key Authentication<\/a> which is more secure.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><a href=\"https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2020\/02\/linux-centos7-ssh-global-settings-05-passauth.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"550\" height=\"238\" src=\"https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2020\/02\/linux-centos7-ssh-global-settings-05-passauth.jpg\" alt=\"\" class=\"wp-image-2859\" srcset=\"https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2020\/02\/linux-centos7-ssh-global-settings-05-passauth.jpg 550w, https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2020\/02\/linux-centos7-ssh-global-settings-05-passauth-300x130.jpg 300w\" sizes=\"auto, (max-width: 550px) 100vw, 550px\" \/><\/a><\/figure><\/div>\n","protected":false},"excerpt":{"rendered":"<p>SSH Global Settings file As you probably know all the SSH related settings are inside one particular text file called &#8220;sshd_config&#8221; and that file is located in the following directory. The following image clearly shows a typical Linux&#8217;s folder structure for you to see where the SSH global settings file is located. How to know &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/lamp.ciscoar.com\/?page_id=2820\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;SSH Global Settings&#8221;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-2820","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/lamp.ciscoar.com\/index.php?rest_route=\/wp\/v2\/pages\/2820","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lamp.ciscoar.com\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/lamp.ciscoar.com\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/lamp.ciscoar.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/lamp.ciscoar.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2820"}],"version-history":[{"count":26,"href":"https:\/\/lamp.ciscoar.com\/index.php?rest_route=\/wp\/v2\/pages\/2820\/revisions"}],"predecessor-version":[{"id":2878,"href":"https:\/\/lamp.ciscoar.com\/index.php?rest_route=\/wp\/v2\/pages\/2820\/revisions\/2878"}],"wp:attachment":[{"href":"https:\/\/lamp.ciscoar.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2820"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}