{"id":222,"date":"2024-11-02T05:00:09","date_gmt":"2024-11-02T05:00:09","guid":{"rendered":"https:\/\/www.yehger.com\/?p=222"},"modified":"2024-11-02T05:07:25","modified_gmt":"2024-11-02T05:07:25","slug":"centos-8-2-%e5%88%9b%e5%bb%bassh%e5%af%86%e9%92%a5","status":"publish","type":"post","link":"https:\/\/www.yehger.com\/index.php\/2024\/11\/02\/centos-8-2-%e5%88%9b%e5%bb%bassh%e5%af%86%e9%92%a5\/","title":{"rendered":"CentOS 8.2 \u521b\u5efassh\u5bc6\u94a5"},"content":{"rendered":"<h2>\u67e5\u5f53\u524d\u7cfb\u7edf\u5bc6\u94a5<\/h2>\n<p>\u5728\u751f\u6210\u65b0\u7684SSH\u5bc6\u94a5\u5bf9\u4e4b\u524d\uff0c\u6700\u597d\u68c0\u67e5 CentOS \u5ba2\u6237\u7aef\u8ba1\u7b97\u673a\u4e0a\u7684\u73b0\u6709SSH\u5bc6\u94a5\u3002<\/p>\n<pre><code class=\"language-c\">ls -l ~\/.ssh\/id_*.pub<\/code><\/pre>\n<p>\u5982\u679c\u547d\u4ee4\u7684\u8f93\u51fa\u8fd4\u56de\u7c7b\u4f3ccannot access \/root\/.ssh\/id_*.pub: No such file or directory\uff0c\u5219\u610f\u5473\u7740\u60a8\u7684\u5ba2\u6237\u7aef\u8ba1\u7b97\u673a\u4e0a\u6ca1\u6709SSH\u5bc6\u94a5\uff0c\u60a8\u53ef\u4ee5\u7ee7\u7eed\u6267\u884c\u4e0b\u4e00\u6b65\u5e76\u751f\u6210SSH\u5bc6\u94a5\u5bf9\u3002<\/p>\n<h2>\u751f\u6210\u5bc6\u94a5<\/h2>\n<p>\u751f\u6210\u4e00\u4e2a\u65b0\u76844096\u4f4dSSH\u5bc6\u94a5\u5bf9\uff0c\u5e76\u586b\u5199\u6ce8\u91ca<\/p>\n<pre><code class=\"language-c\">ssh-keygen -t rsa -b 4096 -C &quot;dai_linux_centos&quot;<\/code><\/pre>\n<p>\u63d0\u793a \u751f\u6210\u516c\u94a5\u548c\u5bc6\u94a5\u5bf9\u4e2d<br \/>\n\u8f93\u5165\u6587\u4ef6\u5730\u5740\u6765\u51b3\u5b9a\u5728\u54ea\u91cc\u4fdd\u5b58\u6587\u4ef6\uff08\u53ef\u4ee5\u76f4\u63a5Enter\u8df3\u8fc7\uff0c\u9ed8\u8ba4\u4fdd\u5b58\u5728\/www\/.ssh\/id_rsa<\/p>\n<pre><code class=\"language-c\">Generating public\/private rsa key pair.\nEnter file in which to save the key (\/www\/.ssh\/id_rsa):<\/code><\/pre>\n<p>\u63d0\u793a\u8f93\u5165\u5bc6\u7801(\u5982\u679c\u662f\u81ea\u52a8\u5316\u7684\u5c31\u4e0d\u8981\u8f93\u5165\u5bc6\u7801\uff0c\u5982\u679c\u662f\u624b\u52a8\u62c9\u53d6\u63a8\u9001\u5c31\u7528)<\/p>\n<pre><code class=\"language-c\">Enter passphrase (empty for no passphrase):<\/code><\/pre>\n<h2>\u751f\u6210\u8fc7\u7a0b<\/h2>\n<pre><code class=\"language-c\">[www@iZj6c5r46uy6phsb91zarsZ root]$ ls -l ~\/.ssh\/id_*.pub\nls: cannot access &#039;\/home\/www\/.ssh\/id_*.pub&#039;: No such file or directory\n[www@iZj6c5r46uy6phsb91zarsZ root]$ ssh-keygen -t rsa -b 4096 -C &quot;dai_linux_centos&quot;\nGenerating public\/private rsa key pair.\nEnter file in which to save the key (\/home\/www\/.ssh\/id_rsa):\n\/home\/www\/.ssh\/id_rsa already exists.\nOverwrite (y\/n)? y\nEnter passphrase (empty for no passphrase):\nEnter same passphrase again:\nYour identification has been saved in \/home\/www\/.ssh\/id_rsa.\nYour public key has been saved in \/home\/www\/.ssh\/id_rsa.pub.\nThe key fingerprint is:\nSHA256:kHOWSUJrK3cu3BXspDRbWMxacDhLSjzy24OIaNWf274 dai_linux_centos\nThe key&#039;s randomart image is:\n+---[RSA 4096]----+\n|     oo o=o      |\n|    . +=+B+      |\n|    .+*+O==      |\n|   . ooBoB .     |\n| .....++S o      |\n|... .+o*o.       |\n|.     o =.       |\n|       o .       |\n|        .E.      |\n+----[SHA256]-----+\n[www@iZj6c5r46uy6phsb91zarsZ root]$<\/code><\/pre>\n<h2>\u4f7f\u7528\u5bc6\u94a5\u5bf9<\/h2>\n<p>\u6253\u5f00\u5b58\u50a8\u5bc6\u94a5\u7684\u6587\u4ef6\u5939(\u5f53\u524d\u662fwww\u7528\u6237)<\/p>\n<pre><code class=\"language-c\">cd \/home\/www\/.ssh<\/code><\/pre>\n<p>\u90e8\u7f72\u516c\u94a5\u5230\u4ed3\u5e93\uff0c\u76f4\u63a5\u590d\u5236\u5373\u53ef<\/p>\n<pre><code class=\"language-c\">vim id_rsa.pub<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u67e5\u5f53\u524d\u7cfb\u7edf\u5bc6\u94a5 \u5728\u751f\u6210\u65b0\u7684SSH\u5bc6\u94a5\u5bf9\u4e4b\u524d\uff0c\u6700\u597d\u68c0\u67e5 CentOS \u5ba2\u6237\u7aef\u8ba1\u7b97\u673a\u4e0a\u7684\u73b0\u6709SSH\u5bc6\u94a5\u3002 ls -l ~\/.ssh\/id_*.pub \u5982\u679c\u547d\u4ee4\u7684\u8f93\u51fa\u8fd4\u56de\u7c7b\u4f3ccannot access \/root\/.ssh\/id_*.pub: No such file or directory\uff0c\u5219\u610f\u5473\u7740\u60a8\u7684\u5ba2\u6237\u7aef\u8ba1\u7b97\u673a\u4e0a\u6ca1\u6709SSH\u5bc6\u94a5\uff0c\u60a8\u53ef\u4ee5\u7ee7\u7eed\u6267\u884c\u4e0b\u4e00\u6b65\u5e76\u751f\u6210SSH\u5bc6\u94a5\u5bf9\u3002 \u751f\u6210\u5bc6\u94a5 \u751f\u6210\u4e00\u4e2a\u65b0\u76844096\u4f4dSSH\u5bc6\u94a5\u5bf9\uff0c\u5e76\u586b\u5199\u6ce8\u91ca ssh-keygen -t rsa&#8230; <a class=\"read-more\" href=\"https:\/\/www.yehger.com\/index.php\/2024\/11\/02\/centos-8-2-%e5%88%9b%e5%bb%bassh%e5%af%86%e9%92%a5\/\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-222","post","type-post","status-publish","format-standard","hentry","category-my-nonsence"],"_links":{"self":[{"href":"https:\/\/www.yehger.com\/index.php\/wp-json\/wp\/v2\/posts\/222","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.yehger.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.yehger.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.yehger.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.yehger.com\/index.php\/wp-json\/wp\/v2\/comments?post=222"}],"version-history":[{"count":3,"href":"https:\/\/www.yehger.com\/index.php\/wp-json\/wp\/v2\/posts\/222\/revisions"}],"predecessor-version":[{"id":226,"href":"https:\/\/www.yehger.com\/index.php\/wp-json\/wp\/v2\/posts\/222\/revisions\/226"}],"wp:attachment":[{"href":"https:\/\/www.yehger.com\/index.php\/wp-json\/wp\/v2\/media?parent=222"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.yehger.com\/index.php\/wp-json\/wp\/v2\/categories?post=222"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.yehger.com\/index.php\/wp-json\/wp\/v2\/tags?post=222"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}