{"id":1710,"date":"2023-03-26T07:22:50","date_gmt":"2023-03-25T23:22:50","guid":{"rendered":"https:\/\/www.appblog.cn\/?p=1710"},"modified":"2023-04-23T21:40:18","modified_gmt":"2023-04-23T13:40:18","slug":"linux-config-public-key-authorization-method-ssh-connection","status":"publish","type":"post","link":"https:\/\/www.appblog.cn\/index.php\/2023\/03\/26\/linux-config-public-key-authorization-method-ssh-connection\/","title":{"rendered":"Linux\u914d\u7f6e\u516c\u94a5\u6388\u6743\u65b9\u5f0fssh\u8fde\u63a5"},"content":{"rendered":"<h2>\u672c\u5730\u673a<\/h2>\n<h3>\u751f\u6210Key<\/h3>\n<pre><code>ssh-keygen -t rsa\n\/\/passphrase\u52a1\u5fc5\u4e3a\u7a7a<\/code><\/pre>\n<p><!-- more --><\/p>\n<p>\u5728<code>~\/.ssh<\/code>\u76ee\u5f55\u4e0b\u751f\u6210\u79c1\u94a5<code>id_rsa<\/code>\u548c\u516c\u94a5<code>id_rsa.pub<\/code><\/p>\n<h3>\u5c06\u516c\u94a5\u4e0a\u4f20\u6216\u590d\u5236\u5230\u76ee\u6807\u673a .ssh \u76ee\u5f55\u4e0b<\/h3>\n<pre><code>ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDun\/aN5lomQhxFn2dYfTOhMnemPJaeaAlaZv9Do2t5vH2KRr7PHv89swkjMC\/HvD0oK+iJ66cAypotqnlizdJv487SWOfQplEa5e6PeIpXDvjeqiuyyb25vbX3Io7IeEli1DupZPjXjmahVf70etKUl5v2GettM3OOKewO4v+q4WabBvyfyrvwrqboX1fbO5j\/X6gAPy7csu0tyrnEGG5D2R\/KkrqIts1lpQ3fx3+wGqidfWDyGqa2e+XQ4l3E60534lB7pq8aACsJrgR5c500Uca9b53dpz8WWwXvfQuda2FFBR5SQ6jVu7jGupHQqOHZb3I\/+I91ol4nxmJaDbJp yezhou@appblog-gateway<\/code><\/pre>\n<h2>\u8fdc\u7a0b\u673a<\/h2>\n<p>\u5728<code>.ssh<\/code>\u76ee\u5f55\u4e0b\u521b\u5efa\u64cd\u4f5c\u673a\u7684\u516c\u94a5\u6587\u4ef6<code>id_rsa.pub<\/code>\uff0c\u5c06\u516c\u94a5\u5185\u5bb9\u62f7\u8d1d\u8fdb\u53bb<\/p>\n<pre><code>vim ~\/.ssh\/id_rsa.pub\n\n\/\/\u6ce8\u610f: \u6743\u9650\u52a1\u5fc5\u8bbe\u7f6e\uff0c\u5426\u5219\u8fde\u63a5\u4e0d\u6210\u529f\nchmod 700 ~\/.ssh\nchmod 600 ~\/.ssh\/id_rsa.pub<\/code><\/pre>\n<h2>\u76ee\u6807\u673a\u914d\u7f6e\u5141\u8bb8\u516c\u79c1\u94a5\u767b\u5f55<\/h2>\n<pre><code># vim \/etc\/ssh\/sshd_config \n# systemctl restart sshd<\/code><\/pre>\n<pre><code>PubkeyAuthentication yes\n\n# The default is to check both .ssh\/authorized_keys and .ssh\/authorized_keys2\n# but this is overridden so installations will only check .ssh\/authorized_keys\n#AuthorizedKeysFile     .ssh\/authorized_keys\nAuthorizedKeysFile      .ssh\/id_rsa.pub<\/code><\/pre>\n<h2>\u5efa\u7acb\u8fde\u63a5<\/h2>\n<pre><code>chmod 400 ~\/.ssh\/id_rsa\nssh yezhou@192.168.0.2 -i ~\/.ssh\/id_rsa<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u672c\u5730\u673a \u751f\u6210Key ssh-keygen -t rsa \/\/passphrase\u52a1\u5fc5\u4e3a\u7a7a \u5728~\/.ssh\u76ee\u5f55\u4e0b [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[96],"class_list":["post-1710","post","type-post","status-publish","format-standard","hentry","category-devops-base","tag-ssh"],"_links":{"self":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/1710","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/comments?post=1710"}],"version-history":[{"count":0,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/1710\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/media?parent=1710"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/categories?post=1710"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/tags?post=1710"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}