{"id":525,"date":"2016-12-30T01:59:22","date_gmt":"2016-12-29T16:59:22","guid":{"rendered":"http:\/\/okamurax.com\/?p=525"},"modified":"2021-09-03T14:09:00","modified_gmt":"2021-09-03T05:09:00","slug":"%e3%82%bb%e3%82%ad%e3%83%a5%e3%83%aa%e3%83%86%e3%82%a3%e9%96%a2%e9%80%a3%e8%a8%ad%e5%ae%9a","status":"publish","type":"post","link":"https:\/\/appbay.org\/?p=525","title":{"rendered":"Ubuntu \u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u95a2\u9023\u8a2d\u5b9a"},"content":{"rendered":"<p>\u30d1\u30b9\u30ef\u30fc\u30c9\u8a8d\u8a3c\u306eSSH\u306e\u5834\u5408<\/p>\n<h2>SSH<\/h2>\n<p>\u30dd\u30fc\u30c8\u306e\u5909\u66f4<\/p>\n<p><span style=\"color: #0000ff;\">sudo vim \/etc\/ssh\/sshd_config<\/span><br \/>\n<span style=\"color: #0000ff;\">Port<\/span><br \/>\n22 &gt; 50022<\/p>\n<p>\u518d\u8d77\u52d5<br \/>\n<span style=\"color: #0000ff;\">service ssh restart<\/span><\/p>\n<p>\u3053\u3053\u3067SSH\u3092\u79d8\u5bc6\u9375\u30fb\u516c\u958b\u9375\u306b\u5207\u308a\u66ff\u3048\u308b\u3002<br \/>\n(\u79d8\u5bc6\u9375\u30fb\u516c\u958b\u9375\u3092\u4f5c\u6210\uff0bTeraTerm\u304b\u3089\u63a5\u7d9a)<\/p>\n<h2>ufw<\/h2>\n<p>\u6700\u521d\u306f\u6709\u52b9\u306b\u306a\u3063\u3066\u3044\u306a\u3044\u3002<\/p>\n<p>IPv6\u7121\u52b9\u5316<br \/>\n<span style=\"color: #0000ff;\">sudo vim \/etc\/default\/ufw<\/span><br \/>\n<span style=\"color: #0000ff;\">IPV6=no<\/span><\/p>\n<p>ssh\u3092\u8a31\u53ef<br \/>\n<span style=\"color: #0000ff;\">sudo ufw allow 50022\/tcp<\/span><\/p>\n<p>\u8d77\u52d5<br \/>\n<span style=\"color: #0000ff;\">sudo ufw enable<br \/>\n<\/span>(enable\u5f8c\u306f\u3001\u518d\u8d77\u52d5\u3057\u3066\u3082ufw\u306f\u6709\u52b9\u306b\u306a\u3063\u3066\u3044\u308b)<\/p>\n<p>\u518d\u8d77\u52d5\u3059\u308b\u5834\u5408<br \/>\n<span style=\"color: #0000ff;\">sudo ufw reload<\/span><\/p>\n<h2>SSH<\/h2>\n<p>\u30eb\u30fc\u30c8\u3092\u5f3e\u304f(\u5fc5\u8981\u306a\u3089)<br \/>\n<span style=\"color: #0000ff;\">sudo vim \/etc\/ssh\/sshd_config<\/span><br \/>\n<span style=\"color: #0000ff;\">PermitRootLogin<\/span><br \/>\n<span style=\"color: #333333;\">yes &gt; no<\/span><\/p>\n<p>\u30d1\u30b9\u30ef\u30fc\u30c9\u8a8d\u8a3c\u3092\u505c\u6b62<br \/>\n<span style=\"color: #0000ff;\">sudo vim \/etc\/ssh\/sshd_config<\/span><br \/>\n<span style=\"color: #0000ff;\">PasswordAuthentication<br \/>\nChallengeResponseAuthentication<br \/>\nGSSAPIAuthentication<\/span><br \/>\n3\u3064\u3068\u3082no\u3078<\/p>\n<p>\u63a5\u7d9a\u30e6\u30fc\u30b6\u3092\u9650\u5b9a(\u5fc5\u8981\u306a\u3089)<br \/>\n<span style=\"color: #0000ff;\">sudo vim \/etc\/ssh\/sshd_config<br \/>\n<\/span><span style=\"color: #0000ff;\">AllowUsers ubuntu<\/span><br \/>\n\u8ffd\u52a0<\/p>\n<p>\u518d\u8d77\u52d5<br \/>\n<span style=\"color: #0000ff;\">service ssh restart<\/span><\/p>\n<h2>\u79d8\u5bc6\u9375\u30fb\u516c\u958b\u9375\u3092\u4f5c\u6210\uff0bTeraTerm\u304b\u3089\u63a5\u7d9a<\/h2>\n<p>\u79d8\u5bc6\u9375\u30fb\u516c\u958b\u9375\u4f5c\u62101<br \/>\n<span style=\"color: #0000ff;\">ssh-keygen -t rsa<\/span><\/p>\n<p>\u30d5\u30a1\u30a4\u30eb\u540d\u3092\u805e\u304b\u308c\u308b\u306e\u3067id\u3068\u3059\u308b\u3002<br \/>\n\u30d1\u30b9\u30d5\u30ec\u30fc\u30ba\u3082\u805e\u304b\u308c\u308b\u3002\u3053\u3053\u3067\u306f\u3068\u308a\u3042\u3048\u305a\u4ed8\u3051\u306a\u3044\u3002<\/p>\n<p>\u516c\u958b\u9375(id.pub)\u3001\u79d8\u5bc6\u9375(id)\u304c\u751f\u6210\u3055\u308c\u308b\u3002<\/p>\n<p>\u79d8\u5bc6\u9375\u30fb\u516c\u958b\u9375\u4f5c\u62102<\/p>\n<p><span style=\"color: #0000ff;\">TeraTerm\uff1e\u8a2d\u5b9a\uff1eSSH\u9375\u751f\u6210<\/span><br \/>\n\u516c\u958b\u9375(id_rsa.pub)\u3001\u79d8\u5bc6\u9375(id_rsa)\u3092\u4fdd\u5b58\u3059\u308b\u3002<\/p>\n<p>\u516c\u958b\u9375\u306e\u5185\u5bb9\u306f<br \/>\n<span style=\"color: #0000ff;\">.ssh\/authorized_keys<\/span><br \/>\n\u306b\u8a18\u8f09\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\u3002<br \/>\n(\u306a\u3051\u308c\u3070\u4f5c\u6210\u3002\u4ed6\u306b\u66f8\u304d\u8fbc\u307f\u304c\u3042\u308b\u5834\u5408\u3001\u65b0\u3057\u3044\u884c\u3067\u3082\u5927\u4e08\u592b)<\/p>\n<p>\u30d1\u30fc\u30df\u30c3\u30b7\u30e7\u30f3\u78ba\u8a8d<br \/>\n<span style=\"color: #0000ff;\">chmod 600 authorized_keys<\/span><\/p>\n<p>\u79d8\u5bc6\u9375\u306f\u30ed\u30fc\u30ab\u30eb\u306b\u4fdd\u5b58\u3057TeraTerm\u306e\u30d5\u30a9\u30eb\u30c0\u3078\u5165\u308c\u308b\u3002<br \/>\n\u540d\u524d\u306f\u5909\u3048\u3066\u3057\u307e\u3063\u3066OK<\/p>\n<p>\u518d\u8d77\u52d5<br \/>\n<span style=\"color: #0000ff;\">service ssh restart<\/span><\/p>\n<p>TeraTerm\u304b\u3089\u63a5\u7d9a<br \/>\n<span style=\"color: #0000ff;\">connect &#8216;192.168.xxx.xxx:50022 \/ssh \/2 \/auth=publickey \/user=xxx \/keyfile=xxx&#8217;<\/span><\/p>\n<h2>WinSCP\u304b\u3089\u63a5\u7d9a<\/h2>\n<p>WinSCP\u306fppk\u5f62\u5f0f\u306a\u306e\u3067\u3001OpenSSH\u2192ppk\u304c\u5fc5\u8981\u3002<br \/>\n<span style=\"color: #0000ff;\">https:\/\/www.chiark.greenend.org.uk\/~sgtatham\/putty\/latest.html<\/span><br \/>\n\u304b\u3089<br \/>\n<span style=\"color: #0000ff;\">puttygen.exe<\/span><br \/>\n\u3092\u4fdd\u5b58\u3057\u3001\u5b9f\u884c\u3059\u308b\u3002<\/p>\n<p>Conversions&gt;Import key\u3067\u79d8\u5bc6\u9375(id_rsa)\u3092\u8aad\u307f\u8fbc\u307f\u3001Save private key\u3067\u4fdd\u5b58\u3059\u308b\u3002<\/p>\n<p>\u65b0\u3057\u3044\u30b5\u30a4\u30c8\u3092\u4f5c\u6210\u3059\u308b\u3002<br \/>\n\u8ee2\u9001\u30d7\u30ed\u30c8\u30b3\u30eb\uff1aSFTP<br \/>\n\u30db\u30b9\u30c8\u540d\uff1aIP\u30a2\u30c9\u30ec\u30b9<br \/>\n\u30dd\u30fc\u30c8\u756a\u53f7\uff1a50022<br \/>\n\u30e6\u30fc\u30b6\u30fc\u540d\uff1aroot<br \/>\n\u30d1\u30b9\u30ef\u30fc\u30c9\uff1a\u7a7a\u767d<\/p>\n<p>\u8a2d\u5b9a\uff1eSSH\uff1e\u8a8d\u8a3c\uff1e\u8a8d\u8a3c\u6761\u4ef6<br \/>\n\u306e\u79d8\u5bc6\u9375\u306b\u3001<br \/>\n*.ppk\u3092\u6307\u5b9a\u3059\u308b\u3002<\/p>\n<p>\u7ba1\u7406\uff1e\u540d\u524d\u3092\u3064\u3051\u3066\u4fdd\u5b58<br \/>\n\u3092\u5b9f\u884c\u3002<\/p>\n<h2>\u9375\u306e\u7a2e\u985e<\/h2>\n<p>\u30fbppk<br \/>\nPuTTY\u5f62\u5f0f<\/p>\n<p>\u30fbpem<br \/>\nOpenSSL\u5f62\u5f0f<br \/>\nOpenSSH7.8\u672a\u6e80<br \/>\n&#8212;&#8211;BEGIN RSA PRIVATE KEY&#8212;&#8211;<\/p>\n<p>\u30fbOpenSSH\u5f62\u5f0f<br \/>\nOpenSSH7.8\u4ee5\u4e0a<br \/>\n&#8212;&#8211;BEGIN OPENSSH PRIVATE KEY&#8212;&#8211;<\/p>\n<p>\u30fbOpenSSH\u516c\u958b\u9375<br \/>\nssh-rsa<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u30d1\u30b9\u30ef\u30fc\u30c9\u8a8d\u8a3c\u306eSSH\u306e\u5834\u5408 SSH \u30dd\u30fc\u30c8\u306e\u5909\u66f4 sudo vim \/etc\/ssh\/sshd_config Port 22 &gt; 50022 \u518d\u8d77\u52d5 service ssh restart \u3053\u3053\u3067SSH\u3092\u79d8\u5bc6\u9375\u30fb &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/appbay.org\/?p=525\" class=\"more-link\"><span class=\"screen-reader-text\">&#8220;Ubuntu \u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u95a2\u9023\u8a2d\u5b9a&#8221; \u306e<\/span>\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[145],"class_list":["post-525","post","type-post","status-publish","format-standard","hentry","category-1","tag-linux"],"_links":{"self":[{"href":"https:\/\/appbay.org\/index.php?rest_route=\/wp\/v2\/posts\/525","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/appbay.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/appbay.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/appbay.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/appbay.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=525"}],"version-history":[{"count":19,"href":"https:\/\/appbay.org\/index.php?rest_route=\/wp\/v2\/posts\/525\/revisions"}],"predecessor-version":[{"id":4566,"href":"https:\/\/appbay.org\/index.php?rest_route=\/wp\/v2\/posts\/525\/revisions\/4566"}],"wp:attachment":[{"href":"https:\/\/appbay.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=525"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/appbay.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=525"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/appbay.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=525"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}