{"id":10117,"date":"2014-07-16T13:35:33","date_gmt":"2014-07-16T18:35:33","guid":{"rendered":"http:\/\/jianmingli.com\/wp\/?p=10117"},"modified":"2014-09-09T14:15:56","modified_gmt":"2014-09-09T19:15:56","slug":"setup-ssh-rsa-key","status":"publish","type":"post","link":"https:\/\/jianmingli.com\/wp\/?p=10117","title":{"rendered":"Setup SSH RSA Key"},"content":{"rendered":"<div class='toc wptoc'>\n<h2>Contents<\/h2>\n<ol class='toc-odd level-1'>\n\t<li>\n\t\t<a href=\"#Setup_Source_Machine\">Setup Source Machine<\/a>\n\t<\/li>\n\t<li>\n\t\t<a href=\"#Setup_Target_Machine\">Setup Target Machine<\/a>\n\t<\/li>\n\t<li>\n\t\t<a href=\"#Test\">Test<\/a>\n\t<\/li>\n<\/ol>\n<\/ol>\n<\/div>\n<div class='wptoc-end'>&nbsp;<\/div>\n<span id=\"Setup_Source_Machine\"><h2>Setup Source Machine<\/h2><\/span>\n<p>* Login the source machine and cd to home directory<br \/>\n* Make a directory named <strong>.ssh<\/strong> if it does not exist already<br \/>\n* Create RSA key<br \/>\n* Copy <strong>public<\/strong> key to destination machine. You can use scp or copy and paste.<\/p>\n<pre lang=\"bash\">\r\nmkdir ~\/.ssh\r\nchmod 700 ~\/.ssh\r\ncd ~\/.ssh\r\nssh-keygen -t rsa\r\nscp .ssh\/id_rsa.pub myid@targetsvr:~\/.ssh\r\n<\/pre>\n<span id=\"Setup_Target_Machine\"><h2>Setup Target Machine<\/h2><\/span>\n<p>* Login the target machine and cd to home directory<br \/>\n* Make a directory named <strong>.ssh<\/strong> if it does not exist already<br \/>\n* Append text from <em>id_rsa.pub<\/em> to <em>authorized_keys2<\/em><br \/>\n* Set file permission on <em>authorized_keys2<\/em><\/p>\n<pre lang=\"bash\">\r\nmkdir ~\/.ssh\r\nchmod 700 ~\/.ssh\r\ncd ~\/.ssh\r\ncat id_rsa.pub >> authorized_keys2\r\nchmod 600 authorized_keys2\r\n<\/pre>\n<span id=\"Test\"><h2>Test<\/h2><\/span>\n<p>* Back to source machine<br \/>\n* Test ssh without password:<\/p>\n<pre lang=\"bash\">\r\nssh -l myid 10.10.1.10\r\nscp myid@10.10.1.10:\/tmp\/*.zip \/tmp\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Setup Source Machine * Login the source machine and cd to home directory * Make a directory named .ssh if it does not exist already * Create RSA key * Copy public key to destination machine. You can use scp &hellip; <a href=\"https:\/\/jianmingli.com\/wp\/?p=10117\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[61],"tags":[160,639,565],"class_list":["post-10117","post","type-post","status-publish","format-standard","hentry","category-linux","tag-linux-2","tag-ssh","tag-unix"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p8cRUO-2Db","_links":{"self":[{"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=\/wp\/v2\/posts\/10117","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=10117"}],"version-history":[{"count":5,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=\/wp\/v2\/posts\/10117\/revisions"}],"predecessor-version":[{"id":10204,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=\/wp\/v2\/posts\/10117\/revisions\/10204"}],"wp:attachment":[{"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=10117"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=10117"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=10117"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}