{"id":23,"date":"2021-03-27T14:32:00","date_gmt":"2021-03-27T14:32:00","guid":{"rendered":"https:\/\/262235.xyz\/?p=23"},"modified":"2021-03-27T14:32:00","modified_gmt":"2021-03-27T14:32:00","slug":"23","status":"publish","type":"post","link":"https:\/\/lyvba.com\/index.php\/2021\/03\/27\/23\/","title":{"rendered":"\u8bc1\u4e66\u767b\u9646\u7684\u811a\u672c.sh"},"content":{"rendered":"<h3>\u8bc1\u4e66\u767b\u9646\u7684\u811a\u672c.sh<\/h3>\n<pre><code>#!\/bin\/bash\n\nmkdir -p ~\/.ssh  &amp;&amp; cd ~\/.ssh\n\n# id_rsa.pub  authorized_keys   SSH \u8df3\u677f\u673a\u516c\u94a5\nauthorized_keys(){\n\ncat &lt;&lt;EOF &gt;&gt;  authorized_keys\n\nssh-rsa \u628a\u4f60\u7684\u516c\u94a5\u653e\u8fd9\u884c root  ##################################\n\nEOF\n}\n\n\nno_use_passwd(){\n    # \u7981\u7528\u5bc6\u7801\u767b\u9646\n    sed -i \"s\/PasswordAuthentication.*\/PasswordAuthentication no\/g\"    \/etc\/ssh\/sshd_config\n    sed -i \"s\/#PasswordAuthentication.*\/PasswordAuthentication no\/g\"   \/etc\/ssh\/sshd_config\n\n    # \u53ea\u80fdSSH2\u8bbf\u95ee,\u8fd9\u4e2a\u5b89\u5168\u6027\u9ad8.\n    sed -i '\/Protocol\/d' \/etc\/ssh\/sshd_config\n    echo \"Protocol 2\" &gt;&gt; \/etc\/ssh\/sshd_config\n\n    # \u91cd\u542fssh\u670d\u52a1\n    systemctl restart ssh\n}\n\n\n##  \u542f\u7528\u529f\u80fd\n\nauthorized_keys\n\nno_use_passwd<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u8bc1\u4e66\u767b\u9646\u7684\u811a\u672c.sh #!\/bin\/bash mkdir -p ~\/.ssh &amp;&amp;  [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8,3],"tags":[23,40],"class_list":["post-23","post","type-post","status-publish","format-standard","hentry","category-linux","category-default","tag-linux","tag-ssh"],"_links":{"self":[{"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/posts\/23","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/comments?post=23"}],"version-history":[{"count":0,"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/posts\/23\/revisions"}],"wp:attachment":[{"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/media?parent=23"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/categories?post=23"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/tags?post=23"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}