{"id":598,"date":"2019-07-25T16:52:35","date_gmt":"2019-07-25T08:52:35","guid":{"rendered":"http:\/\/www.laihp.top\/wordpress\/?p=598"},"modified":"2019-08-26T15:38:40","modified_gmt":"2019-08-26T07:38:40","slug":"linux%e5%88%9b%e5%bb%ba%e7%a7%98%e9%92%a5%e6%96%87%e4%bb%b6%e7%99%bb%e5%bd%95","status":"publish","type":"post","link":"https:\/\/www.laihp.top\/zqb\/?p=598","title":{"rendered":"Linux\u521b\u5efa\u79d8\u94a5\u6587\u4ef6\u767b\u5f55"},"content":{"rendered":"<p>\u751f\u6210 .pem \u6b65\u9aa4\u5982\u4e0b\uff1a<br \/>\n1\u3001<\/p>\n<ul>\n<li>\u5728\u670d\u52a1\u5668\u7aef\u76f4\u63a5\u751f\u6210\u5bc6\u7801\u5bc6\u94a5\u5bf9<br \/>\n$ ssh-keygen -t rsa -b 2048 -v<br \/>\n\u6267\u884c\u4e0a\u8ff0\u547d\u4ee4\u9996\u5148\u4f1a\u8ba9\u4f60\u8f93\u5165\u751f\u6210\u5bc6\u94a5\u7684\u6587\u4ef6\u540d\uff1a\u6211\u8fd9\u91cc\u8f93\u5165\u7684 323\uff0c\u4e4b\u540e\u4e00\u8def\u56de\u8f66\u3002<br \/>\n\u5728\u6267\u884c\u547d\u4ee4\u7684\u5f53\u524d\u76ee\u5f55\u4e0b\u4f1a\u751f\u6210\u4e00\u4e2a323.pub\u3001323\u4e24\u4e2a\u6587\u4ef6\u3002<\/li>\n<\/ul>\n<ul>\n<li>\u6216\u8005\u5728Xshell\u91cc\u521b\u5efa\u79d8\u94a5\u6587\u4ef6\u3002\uff08\u672a\u6d4b\u8bd5\u5b8c\uff09<\/li>\n<\/ul>\n<p>2\u3001<\/p>\n<p>\u628a\u751f\u6210\u7684 323.pub \u901a\u8fc7\u672c\u5730\u547d\u4ee4\u63a8\u9001\u5230\u670d\u52a1\u5668\u7aef\uff0c\u4f7f\u670d\u52a1\u5668\u81ea\u52a8\u6dfb\u52a0\u8ba4\u8bc1\u8fd9\u4e2a\u8bc1\u4e66<br \/>\n$ ssh-copy-id -i 323.pub zhangqing@192.168.3.23<\/p>\n<pre class=\"pure-highlightjs\"><code class=\"null\">zhangqing@zqubuntu:\/data\/ttt$ ssh-copy-id -i 323.pub zhangqing@192.168.3.23\r\n\/usr\/bin\/ssh-copy-id: INFO: Source of key(s) to be installed: \"323.pub\"\r\n\/usr\/bin\/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed\r\n\/usr\/bin\/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys\r\nzhangqing@192.168.3.23's password: \r\n\r\nNumber of key(s) added: 1\r\n\r\nNow try logging into the machine, with:   \"ssh 'zhangqing@192.168.3.23'\"\r\nand check to make sure that only the key(s) you wanted were added.\r\n\r\n\r\n<\/code><\/pre>\n<p>\u53ef\u80fd\u4f1a\u62a5\u9519\uff1a<\/p>\n<table style=\"border-collapse: collapse; width: 100%;\">\n<tbody>\n<tr>\n<td style=\"width: 52.1611%;\"><strong>\u62a5\u9519<\/strong><\/td>\n<td style=\"width: 47.8389%;\"><strong>\u89e3\u51b3<\/strong><\/td>\n<\/tr>\n<tr>\n<td style=\"width: 52.1611%;\">\n<pre class=\"pure-highlightjs\" style=\"font-size: 16px;\"><code class=\"null\">root@zqubuntu:\/data# ssh-copy-id -i \/data\/ttt\/323.pub zhangqing@192.168.3.23\r\n\r\n\/usr\/bin\/ssh-copy-id: ERROR: failed to open ID file '\/data\/ttt\/323': No such file\r\n\t(to install the contents of '\/data\/ttt\/323.pub' anyway, look at the -f option)<\/code><\/pre>\n<\/td>\n<td style=\"width: 47.8389%;\">\u8fd9\u4e2a\u95ee\u9898\u7684\u89e3\u51b3\u529e\u6cd5\u5f88\u7b80\u5355\uff0c\u4f7f\u7528touch\u547d\u4ee4\u5728\u516c\u94a5323.pub\u6240\u5728\u76ee\u5f55\u4e0b\u521b\u5efa\u4e00\u4e2a\u7a7a\u6587\u4ef6\u201c323\u201d\u5373\u53ef\u3002<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>3\u3001<\/p>\n<p>\u5728\u670d\u52a1\u5668\u4e0a\u6d4b\u8bd5\u8fde\u63a5\uff1assh -i 323.pub zhangqing@192.168.3.23<\/p>\n<table style=\"border-collapse: collapse; width: 100%; height: 48px;\">\n<tbody>\n<tr style=\"height: 24px;\">\n<td style=\"width: 50%; height: 24px;\"><strong>\u62a5\u9519<\/strong><\/td>\n<td style=\"width: 50%; height: 24px;\"><strong>\u89e3\u51b3<\/strong><\/td>\n<\/tr>\n<tr>\n<td style=\"width: 50%;\">Permissions 0644 for &#8216;323.pub&#8217; are too open.<br \/>\n\u4ed4\u7ec6\u9605\u8bfb\u4e86\u4e00\u4e0bssh\u6587\u6863\u548c\u8fd9\u53e5\u63d0\u793a\uff0c\u5927\u6982\u7684\u610f\u601d\u65f6ssh\u7684\u79c1\u6709\u5bc6\u94a5\u7684\u6743\u9650\u5f00\u653e\u5c3a\u5ea6\u592a\u5927\u4e86\uff0c\u53ef\u4ee5\u4f9b\u4eba\u968f\u610f&gt;\u6b23\u8d4f\u4e86\uff0cssh\u81ea\u8eab\u7684\u7b56\u7565\u5173\u95ed\u4e86ssh\u3002<\/td>\n<td style=\"width: 50%;\">\u89e3\u51b3\u65b9\u6848\uff1a\u5c06\u6743\u9650\u75310644\u964d\u4f4e\u4e3a0600<br \/>\nroot@zqubuntu:\/data\/ttt# chmod 600 323<\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"width: 50%; height: 24px;\">\n<pre class=\"lang:default decode:true \">root@zqubuntu:\/data\/ttt# ssh -i 323.pub zhangqing@192.168.3.23\r\nLoad key \"323.pub\": invalid format\r\nzhangqing@192.168.3.23: Permission denied (publickey).<\/pre>\n<\/td>\n<td style=\"width: 50%; height: 24px;\">\u524d\u671fXshell\u5efa\u7acb\u7684\u79d8\u94a5\u62a5\u7684\u9519\u8bef\u3002\u540e\u6765\u76f4\u63a5\u5728\u670d\u52a1\u5668\u4e0a\u751f\u6210\u79d8\u94a5\uff0c\u4e0d\u62a5\u9519\u4e86\u3002<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<p>4\u3001<\/p>\n<p>\u590d\u5236323\u6587\u4ef6\u5230\u5ba2\u6237\u7aef\uff0c\u7136\u540e\u53ef\u4ee5\u76f4\u63a5\u7528public key\u65b9\u5f0f\u8fde\u63a5\u3002<\/p>\n<p>.pem\u540e\u7f00\u52a0\u4e0d\u52a0\u90fd\u884c\u3002\u6211\u9ed8\u8ba4\u6ca1\u6709\u8fd9\u4e2a\u540e\u7f00\u4e5f\u6ca1\u6709\u52a0\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u751f\u6210 .pem \u6b65\u9aa4\u5982\u4e0b\uff1a 1\u3001 \u5728\u670d\u52a1\u5668\u7aef\u76f4\u63a5\u751f\u6210\u5bc6\u7801\u5bc6\u94a5\u5bf9 $ ssh-keygen -t rsa -b  &#8230; <a title=\"Linux\u521b\u5efa\u79d8\u94a5\u6587\u4ef6\u767b\u5f55\" class=\"read-more\" href=\"https:\/\/www.laihp.top\/zqb\/?p=598\" aria-label=\"\u7ee7\u7eed\u9605\u8bfbLinux\u521b\u5efa\u79d8\u94a5\u6587\u4ef6\u767b\u5f55\">\u9605\u8bfb\u66f4\u591a<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-598","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/www.laihp.top\/zqb\/index.php?rest_route=\/wp\/v2\/posts\/598","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.laihp.top\/zqb\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.laihp.top\/zqb\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.laihp.top\/zqb\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.laihp.top\/zqb\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=598"}],"version-history":[{"count":11,"href":"https:\/\/www.laihp.top\/zqb\/index.php?rest_route=\/wp\/v2\/posts\/598\/revisions"}],"predecessor-version":[{"id":609,"href":"https:\/\/www.laihp.top\/zqb\/index.php?rest_route=\/wp\/v2\/posts\/598\/revisions\/609"}],"wp:attachment":[{"href":"https:\/\/www.laihp.top\/zqb\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=598"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.laihp.top\/zqb\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=598"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.laihp.top\/zqb\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=598"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}