{"id":133,"date":"2023-03-21T01:47:51","date_gmt":"2023-03-21T01:47:51","guid":{"rendered":"https:\/\/www.cmcroft.com\/?p=133"},"modified":"2023-03-21T01:47:51","modified_gmt":"2023-03-21T01:47:51","slug":"mastering-secure-remote-connections-with-ssh-a-guide-to-the-popular-linux-command","status":"publish","type":"post","link":"https:\/\/www.cmcroft.com\/?p=133","title":{"rendered":"Mastering Secure Remote Connections with SSH: A Guide to the Popular Linux Command"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Welcome to Tech Tuesday! Today, we will be discussing another popular Linux command that is widely used by developers and system administrators: <code>ssh<\/code>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>ssh<\/code> stands for &#8220;secure shell&#8221; and is used to establish a secure, encrypted connection between two computers over an insecure network. This is often used to remotely connect to and manage servers or other computers.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Here&#8217;s how to use <code>ssh<\/code>:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Basic Usage To use <code>ssh<\/code>, simply enter the command followed by the username and hostname (or IP address) of the remote computer you want to connect to. For example:<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>ssh username@hostname<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This will establish a secure connection to the remote computer using your username and the computer&#8217;s hostname.<\/p>\n\n\n\n<ol class=\"wp-block-list\" start=\"2\">\n<li>Public Key Authentication <code>ssh<\/code> also supports public key authentication, which allows you to connect to a remote computer without entering a password each time. To set this up, you need to generate a public\/private key pair on your local computer and then copy the public key to the remote computer. For example:<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>ssh-keygen ssh-copy-id username@hostname<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This will generate a public\/private key pair and then copy the public key to the remote computer, allowing you to connect without entering a password.<\/p>\n\n\n\n<ol class=\"wp-block-list\" start=\"3\">\n<li>Port Forwarding <code>ssh<\/code> also supports port forwarding, which allows you to securely access a service running on a remote computer by forwarding the port to your local computer. For example:<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>ssh -L\u00a08080:localhost:80\u00a0username@hostname<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This will forward port 80 (HTTP) on the remote computer to port 8080 on your local computer, allowing you to access the web server running on the remote computer from your local browser.<\/p>\n\n\n\n<ol class=\"wp-block-list\" start=\"4\">\n<li>Proxy Jump <code>ssh<\/code> also supports proxy jump, which allows you to connect to a remote computer through an intermediate computer. This is useful when you need to connect to a computer that is not directly accessible from your local network. For example:<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>ssh -J username1@hostname1\u00a0username2@hostname2<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This will connect to <code>hostname2<\/code> through <code>hostname1<\/code>, allowing you to access <code>hostname2<\/code> from your local computer.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In conclusion, <code>ssh<\/code> is a powerful command that allows you to securely connect to and manage remote computers over an insecure network. Its support for public key authentication, port forwarding, and proxy jump make it an essential tool for developers and system administrators.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Welcome to Tech Tuesday! Today, we will be discussing another popular Linux command that is widely used by developers and system administrators: ssh. ssh stands for &#8220;secure shell&#8221; and is used to establish a secure, encrypted connection between two computers over an insecure network. This is often used to remotely connect to and manage servers [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[10],"tags":[],"class_list":["post-133","post","type-post","status-publish","format-standard","hentry","category-tech-tuesday"],"_links":{"self":[{"href":"https:\/\/www.cmcroft.com\/index.php?rest_route=\/wp\/v2\/posts\/133","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.cmcroft.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.cmcroft.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.cmcroft.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.cmcroft.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=133"}],"version-history":[{"count":1,"href":"https:\/\/www.cmcroft.com\/index.php?rest_route=\/wp\/v2\/posts\/133\/revisions"}],"predecessor-version":[{"id":134,"href":"https:\/\/www.cmcroft.com\/index.php?rest_route=\/wp\/v2\/posts\/133\/revisions\/134"}],"wp:attachment":[{"href":"https:\/\/www.cmcroft.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=133"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.cmcroft.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=133"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.cmcroft.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=133"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}