{"id":1732,"date":"2012-11-28T19:18:10","date_gmt":"2012-11-28T11:18:10","guid":{"rendered":"http:\/\/rmohan.com\/?p=1732"},"modified":"2012-11-28T19:18:50","modified_gmt":"2012-11-28T11:18:50","slug":"generating-an-openssh-public-key-and-converting-it-to-secsh-format","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=1732","title":{"rendered":"Generating an OpenSSH Public Key and Converting it to SecSh Format"},"content":{"rendered":"<h2>Introduction<\/h2>\n<p>Whilst reviewing access requirements at a number of sites, we&#8217;ve found the need to make several different implementations of SSH clients and servers interoperate succesfully.<\/p>\n<p>This document outlines how to convert keys between OpenSSH, SSH.com (F-Secure), Sun SSH, and PuTTY implementations, using a DSA key for our examples, and also illustrates basic server-side setup for key-based authentication.<\/p>\n<h2>Connect to SSH.com server<\/h2>\n<p>1) Convert key to correct format:<\/p>\n<p>OpenSSH\/Sun SSH &#8211; Use <em>ssh-keygen<\/em> to export from native format to SECSH format:<\/p>\n<pre>ssh-keygen -e -f ~user\/.ssh\/id_dsa.pub &gt; id_dsa_secsh.pub (OpenSSH)\r\n<\/pre>\n<pre>ssh-keygen -x -f ~user\/.ssh\/id_dsa &gt; id_dsa_secsh.pub (Sun SSH)\r\n<\/pre>\n<p>*note that Sun requires the private key as an input, whereas OpenSSH can convert directly from a public key to SECSH format.<\/p>\n<p>(PuTTY and SSH.com clients use the SECSH format natively, so no conversion required)<\/p>\n<p>2) Paste the SECSH file into a file of the same name on the server, located in the <em>.ssh<\/em> directory of the user in question, or <em>scp<\/em> using passwords:<\/p>\n<pre>scp id_dsa_secsh.pub user@target:\/home\/user\/.ssh2\/id_dsa_secsh.pub\r\n<\/pre>\n<p>3) Create or amend the file <em>~user\/.ssh\/authorization<\/em> on the server to include information on the new key:<\/p>\n<pre>echo \"key id_dsa_secsh.pub\" &gt;&gt; ~user\/.ssh2\/authorization\r\n<\/pre>\n<p>4) DSA authentication should now be possible.<\/p>\n<h2>Connect to OpenSSH and Sun SSH servers<\/h2>\n<p>1) Convert key to correct format:<\/p>\n<p>PuTTY &#8211; Use the <em>puttygen.exe<\/em> tool to import the SECSH-formatted file, and copy the OpenSSH-compatible data from the Key window.<\/p>\n<p>SSH.com &#8211; Use either Sun&#8217;s or OpenSSH&#8217;s <em>ssh-keygen<\/em> to convert from SECSH format:<\/p>\n<pre>ssh-keygen -i -f id_dsa_secsh.pub &gt; id_dsa.pub (OpenSSH)\r\n<\/pre>\n<pre>ssh-keygen -X -f id_dsa_secsh.pub &gt; id_dsa.pub (Sun SSH)\r\n<\/pre>\n<p>2) Paste the DSA key into <em>~user\/.ssh\/authorized_keys<\/em> on the server.<\/p>\n<p>3) DSA authentication should now be possible.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction <\/p>\n<p>Whilst reviewing access requirements at a number of sites, we&#8217;ve found the need to make several different implementations of SSH clients and servers interoperate succesfully.<\/p>\n<p>This document outlines how to convert keys between OpenSSH, SSH.com (F-Secure), Sun SSH, and PuTTY implementations, using a DSA key for our examples, and also illustrates basic server-side setup [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/1732"}],"collection":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1732"}],"version-history":[{"count":2,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/1732\/revisions"}],"predecessor-version":[{"id":1735,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/1732\/revisions\/1735"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1732"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1732"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1732"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}