{"id":954,"date":"2016-08-27T11:03:50","date_gmt":"2016-08-27T02:03:50","guid":{"rendered":"http:\/\/usg.mydns.jp\/?p=954"},"modified":"2016-08-27T11:03:50","modified_gmt":"2016-08-27T02:03:50","slug":"ssh%e3%81%ae%e3%81%a1%e3%82%87%e3%81%a3%e3%81%a8%e3%81%97%e3%81%9f%e3%82%bb%e3%82%ad%e3%83%a5%e3%83%aa%e3%83%86%e3%82%a3%e5%af%be%e7%ad%96","status":"publish","type":"post","link":"https:\/\/usg.mydns.jp\/?p=954","title":{"rendered":"ssh\u306e\u3061\u3087\u3063\u3068\u3057\u305f\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u5bfe\u7b56"},"content":{"rendered":"<p>vps\uff08CentOS7\uff09\u3092\u904b\u7528\u3057\u3066\u3044\u308b\u3068\u3001ssh\u306b\u5bfe\u3057\u3066<br \/>\n\u6050\u308d\u3057\u3044\u307b\u3069root\u8a8d\u8a3c\u30ed\u30b0\u304c\u898b\u53d7\u3051\u3089\u308c\u307e\u3059\u3002<\/p>\n<p>\u305d\u308c\u3053\u305d\u3001\u6bce\u65e5\u6570\u5343\u4ee5\u4e0a\u306e\u30ed\u30b0\u304c\u3042\u308a<br \/>\n\u3068\u3066\u3082\u6c17\u6301\u3061\u60aa\u3044\u3002<\/p>\n<p>\u305d\u308c\u306broot\u3092\u53d6\u3089\u308c\u308b\u3068\u3001\u3082\u3046\u305d\u306e\u30b5\u30fc\u30d0\u30fc\u306f\u8ae6\u3081\u308b\u3057\u304b\u306a\u3044\u3067\u3059\u3088\u306d\u3002<\/p>\n<p>\u305d\u3053\u3067\u3001ssh\u306e\u8a2d\u5b9a\u306b\u5de5\u592b\u3092\u3057\u3066<br \/>\n\u5c11\u3057\u3067\u3082\u6c17\u6301\u3061\u60aa\u3044\u30ed\u30b0\u3092\u6e1b\u3089\u305d\u3046\u3068\u3084\u3063\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n<p>\u8a2d\u5b9a\u3092\u5909\u3048\u308b\u9805\u76ee\u306f\uff12\u3064\u3067\u3059<br \/>\n\uff11\uff0essh\u63a5\u7d9a\u6642\u306eroot\u30ed\u30b0\u30a4\u30f3\u3092\u7981\u6b62<br \/>\n\uff12\uff0essh\u306e\u30dd\u30fc\u30c8\u756a\u53f7\u3092\u5909\u3048\u308b<\/p>\n<p>\uff11\uff0essh\u63a5\u7d9a\u6642\u306eroot\u30ed\u30b0\u30a4\u30f3\u3092\u7981\u6b62<br \/>\n\u3053\u3053\u3092\u7de8\u96c6\u3057\u307e\u3059\u3002<br \/>\n# vi \/etc\/ssh\/sshd_config<\/p>\n<p>PermitRootLogin yes<br \/>\n\u3053\u306e\u90e8\u5206\u3092<br \/>\nPermitRootLogin no\u3000\u306b\u5909\u3048\u307e\u3059\u3002<\/p>\n<p>sshd\u3092\u518d\u8d77\u52d5\u3057\u3066<br \/>\n# systemctl restart sshd<br \/>\n# systemctl status sshd    <\/p>\n<p>\u304a\u3063\u3068\uff01\u4ed6\u306b\u4e00\u822c\u30e6\u30fc\u30b6\u30fc\u304c\u3044\u306a\u3044\u3068<br \/>\n\u8ab0\u3082ssh\u63a5\u7d9a\u304c\u51fa\u6765\u306a\u304f\u306a\u3063\u3066\u3057\u307e\u3044\u307e\u3059\u304b\u3089\u3001<br \/>\n\u30e6\u30fc\u30b6\u30fc\u3092\u4f5c\u308a\u307e\u3057\u3087\u3046<\/p>\n<p>\u305f\u3060\u3001\u3053\u306e\u30e6\u30fc\u30b6\u30fc\u540d\u3082\u300cdatabase\u300d\u3084\u300coffice\u300d\u3084\u300csupport\u300d\u306a\u3069<br \/>\n\u3088\u304f\u4f7f\u308f\u308c\u305d\u3046\u306a\u540d\u524d\u304c\u3001\u305d\u308c\u3053\u305da\u304b\u3089z\u307e\u3067<br \/>\n\u7dcf\u5f53\u305f\u308a\u3067\u8a8d\u8a3c\u304c\u3084\u3063\u3066\u6765\u307e\u3059\u304b\u3089\u3001<br \/>\n\u30e6\u30fc\u30b6\u30fc\u540d\u3082\u5de5\u592b\u304c\u5fc5\u8981\u3067\u3059\u3002<\/p>\n<p>\u307e\u305f\u3001\u305d\u306e\u30d1\u30b9\u30ef\u30fc\u30c9\u3082\u5b89\u6613\u306b\u89e3\u8aad\u3067\u304d\u305d\u3046\u306a\u306e\u306f<br \/>\n\u6b62\u3081\u308b\u3079\u304d\u3067\u3059\u306d\u3002<\/p>\n<p>\u305d\u3093\u306a\u4e8b\u3092\u6ce8\u610f\u3057\u306a\u304c\u3089\u4e00\u822c\u30e6\u30fc\u30b6\u30fc\u3092\u767b\u9332\u3057\u307e\u3057\u3087\u3046\u3002 <\/p>\n<p># useradd \u30e6\u30fc\u30b6\u30fc\u540d<\/p>\n<p>\u30d1\u30b9\u30ef\u30fc\u30c9\u3082\u8a2d\u5b9a\u3057\u3066<br \/>\n# passwd \u30e6\u30fc\u30b6\u30fc\u540d<\/p>\n<p>\u5ff5\u306e\u305f\u3081\u30e6\u30fc\u30b6\u30fc\u540d\u306b\u30ed\u30b0\u30a4\u30f3\u3067\u304d\u308b\u304b\u78ba\u8a8d\u3057\u3066\u307f\u307e\u3057\u3087\u3046<\/p>\n<p># su \u30e6\u30fc\u30b6\u30fc\u540d<\/p>\n<p>\u30ed\u30b0\u30a4\u30f3\u3067\u304d\u305f\u3089\u30aa\u30c3\u30b1\u30fc\u3067\u3059\u3002<\/p>\n<p>exit\u3067ssh\u304b\u3089\u629c\u3051\u307e\u3057\u3066\u3001root\u3067\u30ed\u30b0\u30a4\u30f3\u3067\u304d\u308b\u304b<br \/>\n\u78ba\u8a8d\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>\u51fa\u6765\u306a\u3051\u308c\u3070\u30aa\u30c3\u30b1\u30fc\u3067\u3059\u3002<\/p>\n<p>\u4e00\u822c\u30e6\u30fc\u30b6\u30fc\u3067\u30ed\u30b0\u30a4\u30f3\u3057\u3066\u3001\u305d\u306e\u5f8c\u306broot\u306b\u306a\u308c\u3070\u826f\u3044\u3067\u3059\u306d\u3002<\/p>\n<p>\u3053\u308c\u3067\u3061\u3087\u3063\u3068\u3060\u3051\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u304c\u5411\u4e0a\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>\uff12\uff0essh\u306e\u30dd\u30fc\u30c8\u756a\u53f7\u3092\u5909\u3048\u308b<br \/>\n\u30a2\u30bf\u30c3\u30af\u3092\u8a66\u307f\u308bbot\u306a\u3069\u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u306f<br \/>\nnmap\u3092\u4f7f\u3063\u3066\u3001ssh\u30c7\u30d5\u30a9\u30eb\u30c8\u30dd\u30fc\u30c822\u756a\u304c\u958b\u3044\u3066\u308b\u304b\u3092\u898b\u306b\u3044\u304f\u3088\u3046\u3067\u3059\u3002<\/p>\n<p>\u3060\u3063\u305f\u3089\u300122\u756a\u3092\u9589\u3058\u3061\u3083\u3048\u3070bot\u304b\u3089\u7121\u8996\u3055\u308c\u308b\u3002<\/p>\n<p>\u3067\u3001\u81ea\u5206\u5c02\u7528\u306essh\u30dd\u30fc\u30c8\u3092\u958b\u3051\u3066\u3042\u3052\u308c\u3070<br \/>\n\u307e\u305f\u5c11\u3057\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u304c\u5411\u4e0a\u3057\u307e\u3059\u3088\u306d<\/p>\n<p>\u3067\u306f\u3001\u3084\u3063\u3066\u307f\u307e\u3057\u3087\u3046<\/p>\n<p>\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb<br \/>\n# vi \/etc\/ssh\/sshd_config<\/p>\n<p>#Port 22<br \/>\n\u306e\u90e8\u5206\u3092<br \/>\nPort 12345\u3000\u306e\u3088\u3046\u306b\u5909\u3048\u307e\u3057\u3066<\/p>\n<p>sshd\u518d\u8d77\u52d5\u3067\u3059<br \/>\n# systemctl restart sshd<br \/>\n# systemctl status sshd<\/p>\n<p>\u3082\u3046\uff11\u3064\u5fd8\u308c\u306a\u3044\u3067\u6b32\u3057\u3044\u306e\u304c<br \/>\nfirewalld\u306e\u7de8\u96c6\u3067\u3059\u3002<\/p>\n<p>\u81ea\u5206\u7528\u306b\u30ab\u30b9\u30bf\u30de\u30a4\u30ba\u3057\u305f\u3044\u5834\u5408\u306f\u3001<br \/>\n\/usr\/lib\/firewalld\/\u306b\u3042\u308b\u30d5\u30a1\u30a4\u30eb\u3092 \/etc\/firewalld\/\u306b\u30b3\u30d4\u30fc\u3057\u3066\u304b\u3089\u7de8\u96c6\u3057\u307e\u3059\u3002<\/p>\n<p># cp \/usr\/lib\/firewalld\/services\/ssh.xml \/etc\/firewalld\/services\/ssh.xml<\/p>\n<p>\u7de8\u96c6\u3057\u307e\u3059<br \/>\n# vi \/etc\/firewalld\/services\/ssh.xml<\/p>\n<p>\u3053\u306e\u884c\u3092\u524a\u9664\u21d2  port protocol=&#8221;tcp&#8221; port=&#8221;22&#8243;\/<br \/>\n\u3053\u306e\u884c\u3092\u8ffd\u52a0\u21d2  port protocol=&#8221;tcp&#8221; port=&#8221;12345&#8243;\/<\/p>\n<p>\u305d\u3057\u3066firewall\u518d\u8d77\u52d5<br \/>\n# firewall-cmd &#8211;reload<\/p>\n<p>\u78ba\u8a8d<br \/>\n# iptables -L -n | grep 22<br \/>\n# iptables -L -n | grep 12345<\/p>\n<p>\u3053\u308c\u3067\u3001ssh\u30dd\u30fc\u30c8\u304c12345\u307f\u305f\u3044\u306a\u4efb\u610f\u306e\u30dd\u30fc\u30c8\u756a\u53f7\u306b\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n<p>\u6c17\u6301\u3061\u60aa\u3044root\u8a8d\u8a3c\u30ed\u30b0\u304c\u6e1b\u5c11\u3059\u308c\u3070\u826f\u3044\u3067\u3059\u306d\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>vps\uff08CentOS7\uff09\u3092\u904b\u7528\u3057\u3066\u3044\u308b\u3068\u3001ssh\u306b\u5bfe\u3057\u3066 \u6050\u308d\u3057\u3044\u307b\u3069root\u8a8d &hellip; <a href=\"https:\/\/usg.mydns.jp\/?p=954\">\u7d9a\u304d\u3092\u8aad\u3080 <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"gallery","meta":{"footnotes":""},"categories":[14,8],"tags":[],"class_list":["post-954","post","type-post","status-publish","format-gallery","hentry","category-linux","category-8","post_format-post-format-gallery"],"_links":{"self":[{"href":"https:\/\/usg.mydns.jp\/index.php?rest_route=\/wp\/v2\/posts\/954","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/usg.mydns.jp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/usg.mydns.jp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/usg.mydns.jp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/usg.mydns.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=954"}],"version-history":[{"count":8,"href":"https:\/\/usg.mydns.jp\/index.php?rest_route=\/wp\/v2\/posts\/954\/revisions"}],"predecessor-version":[{"id":973,"href":"https:\/\/usg.mydns.jp\/index.php?rest_route=\/wp\/v2\/posts\/954\/revisions\/973"}],"wp:attachment":[{"href":"https:\/\/usg.mydns.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=954"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/usg.mydns.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=954"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/usg.mydns.jp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=954"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}