{"id":892,"date":"2012-08-23T13:01:38","date_gmt":"2012-08-23T18:01:38","guid":{"rendered":"http:\/\/www.gamescheat.ca\/?p=892"},"modified":"2019-09-04T19:57:39","modified_gmt":"2019-09-05T00:57:39","slug":"ssh-login-without-password-using-public-key-authentiation","status":"publish","type":"post","link":"http:\/\/www.gamescheat.ca\/?p=892","title":{"rendered":"SSH Login without password using public key authentiation"},"content":{"rendered":"<p>On Computer A<br \/>\nCreate the public and private keys using the command ssh-keygen<\/p>\n<blockquote><p>[root@computerA .ssh]# ssh-keygen -t rsa<br \/>\nGenerating public\/private rsa key pair.<br \/>\nEnter file in which to save the key (\/root\/.ssh\/id_rsa):<br \/>\nEnter passphrase (empty for no passphrase):<br \/>\nEnter same passphrase again:<br \/>\nYour identification has been saved in \/root\/.ssh\/id_rsa.<br \/>\nYour public key has been saved in \/root\/.ssh\/id_rsa.pub.<br \/>\nThe key fingerprint is:<br \/>\n82:7f:35:8e:05:54:48:3e:4a:3e:af:c7:6a:62:c7:fb root@lin.com<\/p><\/blockquote>\n<p>Note: If you do not enter any passphrase by leaving the field blank, then you will not be prompted for the passphrase when login in to the remote computer.<\/p>\n<div style=\"float: left;\"><div style=\"margin: 15px 15px 15px 15px\";><script type=\"text\/javascript\"><!--\ngoogle_ad_client = \"pub-3319935785736004\";\ngoogle_alternate_color = \"FFFFFF\";\ngoogle_ad_width = 180;\ngoogle_ad_height = 150;\ngoogle_ad_format = \"180x150_as\";\ngoogle_ad_type = \"text_image\";\ngoogle_ad_channel =\"\";\ngoogle_color_border = \"cccccc\";\ngoogle_color_link = \"cc0000\";\ngoogle_color_bg = \"ffffff\";\ngoogle_color_text = \"000000\";\ngoogle_color_url = \"008000\";\n\/\/--><\/script>\n<script type=\"text\/javascript\"\n  src=\"http:\/\/pagead2.googlesyndication.com\/pagead\/show_ads.js\">\n<\/script><\/div><\/div><p>Check to see if the files have been created.<\/p>\n<blockquote><p>[root@computerA .ssh]# ls -l \/root\/.ssh<br \/>\ntotal 16<br \/>\n-rw\u2014\u2014- 1 root root  409 Aug 23 11:38 authorized_keys<br \/>\n-rw\u2014\u2014- 1 root root 1679 Aug 23 11:40 id_rsa<br \/>\n-rw-r\u2013r\u2013 1 root root  409 Aug 23 11:40 id_rsa.pub<br \/>\n-rw-r\u2013r\u2013 1 root root 1212 Dec 12  2011 known_hosts<\/p><\/blockquote>\n<p>Copy the contents of the file id_rsa.pub to the remote computer you wish to login to.  This file is your puiblic key. Simply cut and paste the content of the file id_rsa.pub to the file \/root\/.ssh\/authorized_keys on the remote computer.  Append public key to the file authorized_keys, or create the file if it does not exits.<\/p>\n<p>To simplyfy things you can also use the command ssh-copy-id to copy the public key to the remote computer. See example below.<\/p>\n<blockquote><p>[root@computerA .ssh]# ssh-copy-id -i ~\/.ssh\/id_rsa.pub ComputerB<br \/>\n21<br \/>\nroot@ComputerB\u2019s password:<br \/>\nNow try logging into the machine, with \u201cssh \u2018ComputerB'\u201d, and check in:<\/p>\n<p>  .ssh\/authorized_keys<\/p>\n<p>to make sure we haven\u2019t added extra keys that you weren\u2019t expecting.<\/p><\/blockquote>\n<p>You are done.  Try login in to the computerB from computerA.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>On Computer A Create the public and private keys using the command ssh-keygen [root@computerA .ssh]# ssh-keygen -t rsa Generating public\/private rsa key pair. Enter file in which to save the key (\/root\/.ssh\/id_rsa): Enter passphrase (empty for no passphrase): Enter same&hellip;<\/p>\n<p class=\"more-link-p\"><a class=\"more-link\" href=\"http:\/\/www.gamescheat.ca\/?p=892\">Read more &rarr;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[19],"tags":[21,55,81,35],"_links":{"self":[{"href":"http:\/\/www.gamescheat.ca\/index.php?rest_route=\/wp\/v2\/posts\/892"}],"collection":[{"href":"http:\/\/www.gamescheat.ca\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.gamescheat.ca\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.gamescheat.ca\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.gamescheat.ca\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=892"}],"version-history":[{"count":5,"href":"http:\/\/www.gamescheat.ca\/index.php?rest_route=\/wp\/v2\/posts\/892\/revisions"}],"predecessor-version":[{"id":897,"href":"http:\/\/www.gamescheat.ca\/index.php?rest_route=\/wp\/v2\/posts\/892\/revisions\/897"}],"wp:attachment":[{"href":"http:\/\/www.gamescheat.ca\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=892"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.gamescheat.ca\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=892"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.gamescheat.ca\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=892"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}