{"id":5351,"date":"2019-06-18T16:00:57","date_gmt":"2019-06-18T21:00:57","guid":{"rendered":"https:\/\/www.rushworth.us\/lisa\/?p=5351"},"modified":"2019-06-18T16:02:52","modified_gmt":"2019-06-18T21:02:52","slug":"quicker-way-to-set-up-key-based-authentication","status":"publish","type":"post","link":"https:\/\/www.rushworth.us\/lisa\/?p=5351","title":{"rendered":"Quicker Way To Set Up Key-Based Authentication"},"content":{"rendered":"<p>I&#8217;ve always added my public key to a remote host&#8217;s authorized_keys file manually, but happened across the &#8220;ssh-copy-id&#8221; command which does that for you.<\/p>\n<p>[lisa@workstation-fedora .ssh]$ <strong>ssh-copy-id -o PreferredAuthentications=password -o PubkeyAuthentication=no lisa@fedora123.example.com<\/strong><br \/>\nThe authenticity of host &#8216;fedora123.example.com (10.1.2.3)&#8217; can&#8217;t be established.<br \/>\nECDSA key fingerprint is SHA256:5EuKd5LNRnx5sHgQNFb6HO6W\/p0hQk4pEmShTgj3zyU.<br \/>\nAre you sure you want to continue connecting (yes\/no\/[fingerprint])? yes<br \/>\n\/usr\/bin\/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed<br \/>\n\/usr\/bin\/ssh-copy-id: INFO: 1 key(s) remain to be installed &#8212; if you are prompted now it is to install the new keys<br \/>\nlisa@fedora123.example.com&#8217;s password:<\/p>\n<p>Number of key(s) added: 1<\/p>\n<p>Now try logging into the machine, with: &#8220;ssh -o &#8216;PreferredAuthentications=password&#8217; -o &#8216;PubkeyAuthentication=no&#8217; &#8216;lisa@fedora123.example.com'&#8221;<br \/>\nand check to make sure that only the key(s) you wanted were added.<\/p>\n<p>Omit the -o options when attempting to log in over the key-based authentication. This, of course, presupposes that you <em>have<\/em> a public\/private key pair. To create one, use <strong>ssh-keygen -t rsa -b 2048<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;ve always added my public key to a remote host&#8217;s authorized_keys file manually, but happened across the &#8220;ssh-copy-id&#8221; command which does that for you. [lisa@workstation-fedora .ssh]$ ssh-copy-id -o PreferredAuthentications=password -o PubkeyAuthentication=no lisa@fedora123.example.com The authenticity of host &#8216;fedora123.example.com (10.1.2.3)&#8217; can&#8217;t be established. ECDSA key fingerprint is SHA256:5EuKd5LNRnx5sHgQNFb6HO6W\/p0hQk4pEmShTgj3zyU. Are you sure you want to continue connecting (yes\/no\/[fingerprint])? &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[30],"tags":[783,294,782],"class_list":["post-5351","post","type-post","status-publish","format-standard","hentry","category-system-administration","tag-key-based-authentication","tag-linux","tag-ssh"],"_links":{"self":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts\/5351","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5351"}],"version-history":[{"count":2,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts\/5351\/revisions"}],"predecessor-version":[{"id":5353,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts\/5351\/revisions\/5353"}],"wp:attachment":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5351"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5351"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5351"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}