{"id":2393,"date":"2024-07-31T11:53:04","date_gmt":"2024-07-31T15:53:04","guid":{"rendered":"https:\/\/lowtek.ca\/roo\/?p=2393"},"modified":"2024-07-31T11:53:04","modified_gmt":"2024-07-31T15:53:04","slug":"generating-ssh-key-pairs","status":"publish","type":"post","link":"https:\/\/lowtek.ca\/roo\/2024\/generating-ssh-key-pairs\/","title":{"rendered":"Generating SSH key pairs"},"content":{"rendered":"<p>Despite having had some <a href=\"https:\/\/arstechnica.com\/security\/2024\/04\/what-we-know-about-the-xz-utils-backdoor-that-almost-infected-the-world\/\">excitement<\/a> <a href=\"https:\/\/arstechnica.com\/security\/2024\/07\/regresshion-vulnerability-in-openssh-gives-attackers-root-on-linux\/\">recently<\/a>, <a href=\"https:\/\/en.wikipedia.org\/wiki\/Secure_Shell\">SSH<\/a> continues to be both the utility and a protocol that I use heavily every day. I will also have to shout out to <a href=\"https:\/\/mosh.org\/\">mosh<\/a> which is a must have overlay, if you aren&#8217;t using it &#8211; stop reading this now and <a href=\"https:\/\/mosh.org\/#getting\">go get mosh<\/a>.<\/p>\n<p>Not often, but every once in a while I find myself needing to generate a new key pair for use with SSH. GitHub has one of the best <a href=\"https:\/\/docs.github.com\/en\/authentication\/connecting-to-github-with-ssh\/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent\">articles<\/a> on doing this, but it&#8217;s not quite what I want. I find myself having to re-think the small differences I want to make each time, clearly time to write up what I do so I can just visit this post when I need to generate a key.<\/p>\n<pre class=\"lang:default decode:true\">$ ssh-keygen -t ed25519 -C \"comment here\" -f basename<\/pre>\n<p>Yup, that&#8217;s it. In the directory you run this there will be two files generated. The private key is <code>basename<\/code>, and the public key is <code>basename.pub<\/code>. I&#8217;m also a fan of the <a href=\"https:\/\/linuxize.com\/post\/using-the-ssh-config-file\/\">.ssh\/config file<\/a> which you may want to adopt, this makes it easy to have different keys for different systems.<\/p>\n<p>Breaking down the creation command. We are generating a key using the <a href=\"https:\/\/en.wikipedia.org\/wiki\/EdDSA#Ed25519\">Ed25519<\/a> algorithm, most modern systems will support this. Next up we see that we are adding a comment, I find this useful to identify what the public key is for. Last is the filename(s) we want the output written to.<\/p>\n<p>You&#8217;ll see that comments often have no whitespace in them, if you want to be risk adverse avoid using spaces and use dashes or something.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Despite having had some excitement recently, SSH continues to be both the utility and a protocol that I use heavily every day. I will also have to shout out to mosh which is a must have overlay, if you aren&#8217;t using it &#8211; stop reading this now and go get mosh. Not often, but every &hellip; <a href=\"https:\/\/lowtek.ca\/roo\/2024\/generating-ssh-key-pairs\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Generating SSH key pairs&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6,12],"tags":[],"class_list":["post-2393","post","type-post","status-publish","format-standard","hentry","category-computing","category-how-to"],"_links":{"self":[{"href":"https:\/\/lowtek.ca\/roo\/wp-json\/wp\/v2\/posts\/2393","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lowtek.ca\/roo\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lowtek.ca\/roo\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lowtek.ca\/roo\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lowtek.ca\/roo\/wp-json\/wp\/v2\/comments?post=2393"}],"version-history":[{"count":2,"href":"https:\/\/lowtek.ca\/roo\/wp-json\/wp\/v2\/posts\/2393\/revisions"}],"predecessor-version":[{"id":2395,"href":"https:\/\/lowtek.ca\/roo\/wp-json\/wp\/v2\/posts\/2393\/revisions\/2395"}],"wp:attachment":[{"href":"https:\/\/lowtek.ca\/roo\/wp-json\/wp\/v2\/media?parent=2393"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lowtek.ca\/roo\/wp-json\/wp\/v2\/categories?post=2393"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lowtek.ca\/roo\/wp-json\/wp\/v2\/tags?post=2393"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}