{"id":1358,"date":"2024-05-07T21:29:13","date_gmt":"2024-05-07T13:29:13","guid":{"rendered":"http:\/\/oneai.eu.org\/?p=1358"},"modified":"2024-05-08T09:37:39","modified_gmt":"2024-05-08T01:37:39","slug":"%e4%ba%9a%e9%a9%ac%e8%bf%85ec2_vps_ssh%e7%99%bb%e5%bd%95%e9%85%8d%e7%bd%ae","status":"publish","type":"post","link":"https:\/\/oneai.eu.org\/?p=1358","title":{"rendered":"\u4e9a\u9a6c\u8fc5EC2_vps_ssh\u767b\u5f55\u914d\u7f6e"},"content":{"rendered":"\n<p>1\u3001\u5728\u5b9e\u4f8b\u7ba1\u7406\u9762\u677f\u4e2d\uff1a EC2-\u5b9e\u4f8b-i-055897e40d6fc6330--\u8fde\u63a5\u5230\u5b9e\u4f8b<br>\u4f7f\u7528\u4e9a\u9a6c\u8fc5\u63d0\u4f9b\u7684web\u7aef\u5de5\u5177\u5148\u8fde\u63a5\u5230\u5b9e\u4f8b<br>\u4f7f\u7528\u666e\u901a\u8d26\u53f7\u767b\u5f55<br>\u5bf9\u4e8eAmazon Linux AMI\uff0c\u7528\u6237\u540d\u4e3a ec-user\u3002<br>\u5bf9\u4e8eUbuntu AMI\uff0c\u7528\u6237\u540d\u4e3aubuntu\u6216root \u3002<br>\u5bf9\u4e8eCentos AMI\uff0c\u7528\u6237\u540d\u4e3acentos\u6216root\u3002<br>\u5982\u679cec2-user\u548croot\u65e0\u6cd5\u4f7f\u7528\uff0c\u8bf7\u4e8eAMI\u4f9b\u5e94\u5546\u6838\u5b9e\u3002<br>2.\u7ed9root\u8bbe\u7f6e\u5bc6\u7801<br>\u6267\u884c\uff1a<br>sudo su \/\/\u5207\u6362\u5230root \u6216\u8005 su\/\/\u5207\u6362\u5230root<br>passwd \/\/\u7ed9root\u7528\u6237\u8bbe\u7f6e\u5bc6\u7801<\/p>\n\n\n\n<p>3.\u4fee\u6539 \/etc\/ssh\/sshd_config<br>cp \/etc\/ssh\/sshd_config \/etc\/ssh\/sshd_config.bak<br>vi \/etc\/ssh\/sshd_config<br>\u5728sshd_config\u6587\u4ef6\u4e2d \u6309enter\u952e\u4e00\u76f4\u5f80\u4e0b\u627e\uff0c\u76f4\u5230\u627e\u5230\u4ee5\u4e0b\u5185\u5bb9\uff0c\u82e5\u8be5\u884c\u4ee3\u7801\u88ab#\u6ce8\u91ca\u6389\uff0c\u5148\u5220\u9664 # \u3002\u7136\u540e\u6309\u4e0b\u6587\u63d0\u793a\u4fee\u6539\u76f8\u5e94yes\/no<\/p>\n\n\n\n<p>PermitRootLogin yes<\/p>\n\n\n\n<p>PubkeyAuthentication no<\/p>\n\n\n\n<p>PasswordAuthentication yes<\/p>\n\n\n\n<p>4.\u91cd\u542fssh\u670d\u52a1<br>systemctl restart sshd<\/p>\n\n\n\n<p>\u4e2a\u4eba\u4e9a\u9a6c\u8fc5\u4e91   \u4e1c\u4eac<\/p>\n","protected":false},"excerpt":{"rendered":"<p>1\u3001\u5728\u5b9e\u4f8b\u7ba1\u7406\u9762\u677f\u4e2d\uff1a EC2-\u5b9e\u4f8b-i-055897e40d6fc6330&#8211;\u8fde\u63a5\u5230\u5b9e\u4f8b\u4f7f\u7528\u4e9a\u9a6c\u8fc5\u63d0\u4f9b\u7684web\u7aef\u5de5\u5177\u5148\u8fde\u63a5\u5230\u5b9e\u4f8b\u4f7f\u7528\u666e\u901a\u8d26\u53f7\u767b\u5f55\u5bf9\u4e8eAmazon Linux AMI\uff0c\u7528\u6237\u540d\u4e3a ec-user\u3002\u5bf9\u4e8eUbuntu AMI\uff0c\u7528\u6237\u540d\u4e3aubuntu\u6216root \u3002\u5bf9\u4e8eCentos AMI\uff0c\u7528\u6237\u540d\u4e3acentos\u6216root\u3002\u5982\u679cec2-user\u548croot\u65e0\u6cd5\u4f7f\u7528\uff0c\u8bf7\u4e8eAMI\u4f9b\u5e94\u5546\u6838\u5b9e\u30022.\u7ed9root\u8bbe\u7f6e\u5bc6\u7801\u6267\u884c\uff1asudo su \/\/\u5207\u6362\u5230root \u6216\u8005 su\/\/\u5207\u6362\u5230rootpasswd \/\/\u7ed9root\u7528\u6237\u8bbe\u7f6e\u5bc6\u7801 3.\u4fee\u6539 \/etc\/ssh\/sshd_configcp \/etc\/ssh\/sshd_config \/etc\/ssh\/sshd_config.bakvi \/etc\/ssh\/sshd_config\u5728sshd_config\u6587\u4ef6\u4e2d \u6309enter\u952e\u4e00\u76f4\u5f80\u4e0b\u627e\uff0c\u76f4\u5230\u627e\u5230\u4ee5\u4e0b\u5185\u5bb9\uff0c\u82e5\u8be5\u884c\u4ee3\u7801\u88ab#\u6ce8\u91ca\u6389\uff0c\u5148\u5220\u9664 # \u3002\u7136\u540e\u6309\u4e0b\u6587\u63d0\u793a\u4fee\u6539\u76f8\u5e94yes\/no PermitRootLogin yes PubkeyAuthentication no PasswordAuthentication yes 4.\u91cd\u542fssh\u670d\u52a1systemctl restart sshd \u4e2a\u4eba\u4e9a\u9a6c\u8fc5\u4e91 \u4e1c\u4eac<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_eb_attr":"","footnotes":""},"categories":[99,82],"tags":[],"class_list":["post-1358","post","type-post","status-publish","format-standard","hentry","category-centos","category-82"],"_links":{"self":[{"href":"https:\/\/oneai.eu.org\/index.php?rest_route=\/wp\/v2\/posts\/1358","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/oneai.eu.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/oneai.eu.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/oneai.eu.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/oneai.eu.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1358"}],"version-history":[{"count":1,"href":"https:\/\/oneai.eu.org\/index.php?rest_route=\/wp\/v2\/posts\/1358\/revisions"}],"predecessor-version":[{"id":1359,"href":"https:\/\/oneai.eu.org\/index.php?rest_route=\/wp\/v2\/posts\/1358\/revisions\/1359"}],"wp:attachment":[{"href":"https:\/\/oneai.eu.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1358"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/oneai.eu.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1358"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/oneai.eu.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1358"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}