{"id":1867,"date":"2022-05-18T11:44:12","date_gmt":"2022-05-18T09:44:12","guid":{"rendered":"https:\/\/nguenkam.com\/blog\/?p=1867"},"modified":"2022-05-18T11:47:45","modified_gmt":"2022-05-18T09:47:45","slug":"ssh-basics","status":"publish","type":"post","link":"https:\/\/nguenkam.com\/blog\/index.php\/2022\/05\/18\/ssh-basics\/","title":{"rendered":"SSH : Basics"},"content":{"rendered":"\n<h4>What is SSH<\/h4>\n\n\n\n<p>SSH(Secure Shell), is a UNIX-based command interface and protocol for securely getting access to a remote computer. SSH uses public key cryptography for both connection and authentication. SSH is the default tool for system administrator to perform various tasks on servers remotely.<\/p>\n\n\n\n<h4>When do we need to use SSH<\/h4>\n\n\n\n<p>As we all know, cloud servers are becoming more and more affordable. Thus more and more clients prefer to use cloud server for their websites. As a developer, it has become inevitable to learn system administration.<\/p>\n\n\n\n<p>SSH is the most commonly used tool to perform various tasks on cloud servers. Times we need to use SSH as a developer:<\/p>\n\n\n\n<ul><li>Setup a web server for a client&#8217;s website.<\/li><li>Deploy source code to a production server.<\/li><\/ul>\n\n\n\n<h4>SSH client<\/h4>\n\n\n\n<p>In order to use SSH to access your server remotely, you will need a SSH client on your local machine.<\/p>\n\n\n\n<h4>SSH keys: how it works<\/h4>\n\n\n\n<p>Generating a SSH-key pair provides you with two long strings: a <em><strong>public<\/strong><\/em> and a <em><strong>private<\/strong><\/em> key.<br>You can place the public key on any server and then unlock it by connecting to it with a client who already has the private key.<\/p>\n\n\n\n<p>When the two match, the system unlocks without the need for a password.<br><em><span class=\"has-inline-color has-vivid-cyan-blue-color\">You can further increase security by protecting the private key with a passphrase.<\/span><\/em><\/p>\n\n\n\n<p>The SSH-2 protocol supports several encryption algorithms like <strong>RSA,<\/strong> <strong>DSA<\/strong>, <strong>ECDSA<\/strong> and <strong>Ed25519<\/strong>.<br>The pair of SSH keys consist of:<\/p>\n\n\n\n<ul><li><em><strong>A public key<\/strong><\/em>: which is copied to the SSH server(s)<\/li><li><em><strong>A private key<\/strong><\/em>: which is stored in the SSH client .<\/li><\/ul>\n\n\n\n<p>Here are the algorithms and type of SSH key to use and not to use depending on the length of the key:<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" src=\"https:\/\/nguenkam.com\/blog\/wp-content\/uploads\/2022\/05\/image.png\" alt=\"\" class=\"wp-image-1904\" width=\"699\" height=\"222\" srcset=\"https:\/\/nguenkam.com\/blog\/wp-content\/uploads\/2022\/05\/image.png 967w, https:\/\/nguenkam.com\/blog\/wp-content\/uploads\/2022\/05\/image-300x96.png 300w, https:\/\/nguenkam.com\/blog\/wp-content\/uploads\/2022\/05\/image-768x245.png 768w\" sizes=\"(max-width: 699px) 100vw, 699px\" \/><\/figure><\/div>\n\n\n\n<h4>How to generate SSH keys<\/h4>\n\n\n\n<p>The SSH client on Windows 10 and Linux works the same.<\/p>\n\n\n\n<ul><li>Open a terminal<\/li><li>Stay logged in with the user you want to log into the SSH server as. <em>Don&#8217;t use sudo<\/em>, then type:<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>ssh-keygen -t rsa<\/code><\/pre>\n\n\n\n<p>your SSH key pair is generated. You must then transfer the public key to the SSH server, for this you can use <em><strong>ssh-copy-id<\/strong><\/em>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ssh-copy-id &lt;user&gt;@&lt;host&gt;<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>What is SSH SSH(Secure Shell), is a UNIX-based command interface and protocol for securely getting access to a remote computer. SSH uses public key cryptography for both connection and authentication. SSH is the default tool for system administrator to perform various tasks on servers remotely. When do we need to use SSH As we all [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":1908,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1,169,31],"tags":[543,536,241,545],"_links":{"self":[{"href":"https:\/\/nguenkam.com\/blog\/index.php\/wp-json\/wp\/v2\/posts\/1867"}],"collection":[{"href":"https:\/\/nguenkam.com\/blog\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nguenkam.com\/blog\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nguenkam.com\/blog\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/nguenkam.com\/blog\/index.php\/wp-json\/wp\/v2\/comments?post=1867"}],"version-history":[{"count":3,"href":"https:\/\/nguenkam.com\/blog\/index.php\/wp-json\/wp\/v2\/posts\/1867\/revisions"}],"predecessor-version":[{"id":1909,"href":"https:\/\/nguenkam.com\/blog\/index.php\/wp-json\/wp\/v2\/posts\/1867\/revisions\/1909"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/nguenkam.com\/blog\/index.php\/wp-json\/wp\/v2\/media\/1908"}],"wp:attachment":[{"href":"https:\/\/nguenkam.com\/blog\/index.php\/wp-json\/wp\/v2\/media?parent=1867"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nguenkam.com\/blog\/index.php\/wp-json\/wp\/v2\/categories?post=1867"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nguenkam.com\/blog\/index.php\/wp-json\/wp\/v2\/tags?post=1867"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}