{"id":517,"date":"2019-02-19T17:30:39","date_gmt":"2019-02-19T08:30:39","guid":{"rendered":"https:\/\/windabaft.co.jp\/blog_ceo\/?p=517"},"modified":"2019-02-23T19:48:26","modified_gmt":"2019-02-23T10:48:26","slug":"vps-%e3%82%b5%e3%83%bc%e3%83%90%e3%83%bc%e3%81%ae%e5%88%9d%e6%9c%9f%e8%a8%ad%e5%ae%9a-1","status":"publish","type":"post","link":"https:\/\/windabaft.co.jp\/blog_ceo\/?p=517","title":{"rendered":"VPS \u30b5\u30fc\u30d0\u30fc CentOS 7.4 \u306e\u521d\u671f\u8a2d\u5b9a 1"},"content":{"rendered":"\n<p>VPS\u30b5\u30fc\u30d0\u30fc\u3092\u521d\u3081\u3066\u5229\u7528\u3059\u308b\u969b\u306b\u6700\u521d\u306b\u3057\u305f\u307b\u3046\u304c\u3044\u3044\u3053\u3068\u66f8\u3044\u3066\u307f\u307e\u3057\u305f\u3002<br \/>WebArena\u306eCentOS7.4\u306eVPS\u30b5\u30fc\u30d0\u30fc\u3068Mac\u306e\u30bf\u30fc\u30df\u30ca\u30eb\u3092\u5229\u7528\u3002<br \/><\/p>\n\n\n\n<p>\u2460 \u4f5c\u696d\u7528\u30e6\u30fc\u30b6\u30fc\u3092\u4f5c\u6210\u3057\u3066\u3001root\u30ed\u30b0\u30a4\u30f3\u3092\u7981\u6b62\u3059\u308b<\/p>\n\n\n\n<p>\u30c7\u30d5\u30a9\u30eb\u30c8\u3067\u306froot\u30ed\u30b0\u30a4\u30f3\u3057\u304b\u3067\u304d\u306a\u3044\u72b6\u614b\u3067\u3059\u304c\u3001root\u30ed\u30b0\u30a4\u30f3\u3067\u304d\u308b\u72b6\u614b\u3068\u3044\u3046\u4e8b\u306f\u3001\u3082\u3057\u8ab0\u304b\u306broot\u30ed\u30b0\u30a4\u30f3\u3055\u308c\u3066\u3057\u307e\u3046\u3068\u3001\u306a\u3093\u3067\u3082\u3067\u304d\u3066\u3057\u307e\u3046\u975e\u5e38\u306b\u5371\u967a\u306a\u72b6\u614b\u306a\u306e\u3067 \u3053\u308c\u3092\u7981\u6b62\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\u307e\u305aRPM\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u6700\u65b0\u306b\u66f4\u65b0\u3057\u3066\u304a\u304d\u307e\u3057\u3087\u3046\nsudo yum -y update<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>VPS\u306bMAC\u30bf\u30fc\u30df\u30ca\u30eb\u304b\u3089SSH\u3067\u63a5\u7d9a\u3057\u3066\u304f\u3060\u3055\u3044\uff08\u30c7\u30d5\u30a9\u30eb\u30c8\u3067\u306froot\uff09\nsudo ssh root@IP\u30a2\u30c9\u30ec\u30b9 -i .\/.ssh\/\u30c7\u30d5\u30a9\u30eb\u30c8\u306eroot\u7528ssh\u30ad\u30fc.pem\n\n1. \u30e6\u30fc\u30b6\u30fc\u4f5c\u6210 \uff08\u30e6\u30fc\u30b6\u30fc\u540dhoge\u306f\u81ea\u7531\u306b\u7f6e\u304d\u63db\u3048\u3066\u304f\u3060\u3055\u3044\uff09\n# useradd -G wheel hoge \n\u203b\u30b0\u30eb\u30fc\u30d7\u540d\u306ewheel\u306fsudo\u30b3\u30de\u30f3\u30c9\u304c\u4f7f\u3048\u308b\u7ba1\u7406\u8005\u30b0\u30eb\u30fc\u30d7\u540d\u3068\u3057\u3066\u4f7f\u308f\u308c\u308b\n\n2. \u4f5c\u6210\u3057\u305f\u30e6\u30fc\u30b6\u30fc\u306b\u30d1\u30b9\u30ef\u30fc\u30c9\u3092\u8a2d\u5b9a\u3059\u308b \n# passwd hoge\n\u2192\u30a8\u30f3\u30bf\u30fc\u5f8c\u306b\u30d1\u30b9\u30ef\u30fc\u30c9\u3092\u6c42\u3081\u3089\u308c\u308b\u306e\u3067\u3001\u305d\u3053\u3067\u5165\u529b\u3059\u308b\n\nnano\u30a8\u30c7\u30a3\u30bf\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\uff08\u30c7\u30d5\u30a9\u30eb\u30c8\u3067vi\u5165\u3063\u3066\u3044\u308b\u306e\u3067\u3001\u597d\u304d\u306a\u30a8\u30c7\u30a3\u30bf\u4f7f\u3063\u3066\u304f\u3060\u3055\u3044\uff09\n# yum install nano\n\n3. \u4f5c\u696d\u7528\u30e6\u30fc\u30b6\u30fc\u306bsudo\u6a29\u9650\u3092\u4ed8\u4e0e\n# nano \/etc\/sudoers (\u3082\u3057\u304f\u306f sudo visudo \uff09\n\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u4e2d\u3067\u4e0b\u8a18\u304c\u30b3\u30e1\u30f3\u30c8(#)\u3055\u308c\u3066\u3044\u305f\u5834\u5408\u306f\u30b3\u30e1\u30f3\u30c8\u3092\u5916\u3057\u3066\u4fdd\u5b58\n%wheel  ALL=(ALL)       ALL\n\n4. SSH\u306e\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u78ba\u8a8d\u30fb\u5909\u66f4\n# nano \/etc\/ssh\/sshd_config\n\n\u4e0b\u8a18\uff12\u7b87\u6240\u304c\u30b3\u30e1\u30f3\u30c8(#)\u3055\u308c\u3066\u3044\u305f\u5834\u5408\u306f\u30b3\u30e1\u30f3\u30c8\u3092\u5916\u3057\u3066\u4fdd\u5b58\nPubkeyAuthentication yes\nAuthorizedkeysFile .ssh\/authorized_keys\n\u5ff5\u306e\u305f\u3081\nPasswordAuthentication no\n\u306b\u306a\u3063\u3066\u3044\u308b\u304b\u3082\u78ba\u8a8d\n\nRSSAuthentication no\n\u3092\u8a2d\u5b9a\u3059\u308b\u5fc5\u8981\u306f2016\u5e74\u306eopenSSH7.4\u304b\u3089\u5fc5\u8981\u306a\u304f\u306a\u308a\u307e\u3057\u305f\u3002\n\n5. sshd\u3092\u30ea\u30ed\u30fc\u30c9\u3059\u308b\n\uff08CentOS7\u304b\u3089\u306fservice\u30b3\u30de\u30f3\u3067\u306f\u306a\u304fsystemctl\u30b3\u30de\u30f3\u30c9\u3092\u4f7f\u3044\u307e\u3059\uff09\n# systemctl reload sshd\n\n\u30a2\u30af\u30bb\u30b9\u5143\uff08\u81ea\u5206\u4ee5\u5916\u306eIP1\u30a2\u30c9\u30ec\u30b9\u304b\u3089\u306e\u30a2\u30af\u30bb\u30b9\uff09\u3092\u5236\u9650\u3057\u305f\u3044\u5834\u5408\u306b\u306f\u4e0b\u8a18\u306b\u8a2d\u5b9a\u3059\u308b\n# nano \/etc\/hosts.allow\n\u2192sshd: IP\u30a2\u30c9\u30ec\u30b9\n\u3092\u8ffd\u8a18\u3059\u308b<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>6. \u4f5c\u696d\u7528\u30e6\u30fc\u30b6\u30fc(hoge)\u306e\u516c\u958b\u9375\u4fdd\u5b58\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u4f5c\u6210\n\uff08\u30e6\u30fc\u30b6\u30fc\u540dhoge\u306f\u81ea\u7531\u306b\u7f6e\u304d\u63db\u3048\u3066\u304f\u3060\u3055\u3044\uff09\n# sudo -u hoge mkdir \/home\/hoge\/.ssh\n\nMac\u3067\u30ad\u30fc\u30da\u30a2\u4f5c\u6210\u3059\u308b\u306e\u3067\u4e00\u6642SSH\u7d42\u4e86\u3059\u308b\n# exit\n\n7. \u4f5c\u696d\u7528\u30e6\u30fc\u30b6\u30fcSSH\u7528\u306e\u30ad\u30fc\u30da\u30a2\u3092Mac\u3067\u4f5c\u6210\nssh-keygen -t rsa -b 4096 -f id_rsa_filename\n(filename\u306f\u4ed6\u306e\u30ad\u30fc\u3068\u6df7\u540c\u3057\u306a\u3044\u3088\u3046\u81ea\u7531\u306b\u5909\u3048\u3066\u304f\u3060\u3055\u3044\u3001id_rsa\u3060\u3051\u3067\u3082OK\uff09\n\n\u30d1\u30b9\u30d5\u30ec\u30fc\u30ba\u3092\u8a2d\u5b9a\n\n8. \u30ad\u30fc\u30da\u30a2\u304c\u30db\u30fc\u30e0\u306b\u4f5c\u6210\u3055\u308c\u308b\u306e\u3067ssh\u3092\u7ba1\u7406\u3057\u3066\u3044\u308b.ssh\u30d5\u30a9\u30eb\u30c0\u306b\u79fb\u52d5\u3055\u305b\u308b\nmv id_rsa_filename ~\/.ssh \nmv id_rsa_filename.pub ~\/.ssh\n\n9. \u30ad\u30fc\u30da\u30a2\u306e\u3046\u3061\u516c\u958b\u9375\u3067\u3042\u308bid_rsa_filename.pub\u30d5\u30a1\u30a4\u30eb\u3092VPS\u30b5\u30fc\u30d0\u30fc\u306bSCP\uff08root\u306e\u9375\u8a8d\u8a3c\u3092\u4f7f\u3063\u3066\u30ea\u30e2\u30fc\u30c8\u306b\u30b3\u30d4\u30fc\u3059\u308b\uff09\nsudo scp -i ~\/.ssh\/\u30c7\u30d5\u30a9\u30eb\u30c8\u306eroot\u7528ssh\u30ad\u30fc.pem ~\/.ssh\/id_rsa_filename.pub root@IP\u30a2\u30c9\u30ec\u30b9:\/home\/hoge\/.ssh\/\n\n10. \u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3057\u305f\u516c\u958b\u9375\u306e\u540d\u524d\u3001\u6240\u6709\u8005\u30fb\u30b0\u30eb\u30fc\u30d7\u3001\u30d1\u30fc\u30df\u30c3\u30b7\u30e7\u30f3\u5909\u66f4\nVPS\u30b5\u30fc\u30d0\u30fc\u3068ssh\u63a5\u7d9a\u3057\u3066\u304b\u3089\u4e0b\u8a18\u3092\u5b9f\u884c\n# cd \/home\/hoge\/.ssh\/\n# mv id_rsa_filename.pub authorized_keys\n# chown hoge:hoge authorized_keys\n# chmod 600 authorized_keys\n# chmod 700 \/home\/hoge\/.ssh\n# exit\n\n11. Mac\u304b\u3089\u4f5c\u696d\u7528\u30e6\u30fc\u30b6\u30fc\u3067SSH\nsudo ssh hoge@IP\u30a2\u30c9\u30ec\u30b9 -i .\/.ssh\/id_rsa_filename\n\u30d1\u30b9\u30ef\u30fc\u30c9\u3044\u308c\u3066\u63a5\u7d9a\u3067\u304d\u308c\u3070\u6210\u529f\n\n12. root\u63a5\u7d9a\uff08root\u30ed\u30b0\u30a4\u30f3\uff09\u3092\u7981\u6b62\u3059\u308b\n# sudo nano \/etc\/ssh\/sshd_config\nPermitRootLogin without-password\n\u2193\nPermitRootLogin no\n\u3068\u3044\u3046\u3088\u3046\u306b\n\"without-password \u2192 no\"\n\u306b\u5909\u66f4\u3057\u3066\u3001\u4fdd\u5b58\u3002\n\n13. sshd\u30ea\u30ed\u30fc\u30c9\u3059\u308b\n# systemctl reload sshd\n\u3053\u308c\u3067\u6700\u521d\u3067\u304d\u3066\u3044\u305f\u3001root\u30ed\u30b0\u30a4\u30f3\u3092\u8a66\u3057\u3066\u62d2\u5426\u3055\u308c\u308c\u3070\u6210\u529f<\/code><\/pre>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>VPS\u30b5\u30fc\u30d0\u30fc\u3092\u521d\u3081\u3066\u5229\u7528\u3059\u308b\u969b\u306b\u6700\u521d\u306b\u3057\u305f\u307b\u3046\u304c\u3044\u3044\u3053\u3068\u66f8\u3044\u3066\u307f\u307e\u3057\u305f\u3002WebArena\u306eCentOS7.4\u306eVPS\u30b5\u30fc\u30d0\u30fc\u3068Mac\u306e\u30bf\u30fc\u30df\u30ca\u30eb\u3092\u5229\u7528\u3002 \u2460 \u4f5c\u696d\u7528\u30e6\u30fc\u30b6\u30fc\u3092\u4f5c\u6210\u3057\u3066\u3001root\u30ed\u30b0\u30a4\u30f3\u3092\u7981\u6b62\u3059\u308b \u30c7\u30d5\u30a9 &hellip; <a href=\"https:\/\/windabaft.co.jp\/blog_ceo\/?p=517\" class=\"more-link\">\u7d9a\u304d\u3092\u8aad\u3080 <span class=\"screen-reader-text\">VPS \u30b5\u30fc\u30d0\u30fc CentOS 7.4 \u306e\u521d\u671f\u8a2d\u5b9a 1<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":519,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[15],"tags":[],"class_list":["post-517","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/windabaft.co.jp\/blog_ceo\/index.php?rest_route=\/wp\/v2\/posts\/517","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/windabaft.co.jp\/blog_ceo\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/windabaft.co.jp\/blog_ceo\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/windabaft.co.jp\/blog_ceo\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/windabaft.co.jp\/blog_ceo\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=517"}],"version-history":[{"count":5,"href":"https:\/\/windabaft.co.jp\/blog_ceo\/index.php?rest_route=\/wp\/v2\/posts\/517\/revisions"}],"predecessor-version":[{"id":528,"href":"https:\/\/windabaft.co.jp\/blog_ceo\/index.php?rest_route=\/wp\/v2\/posts\/517\/revisions\/528"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/windabaft.co.jp\/blog_ceo\/index.php?rest_route=\/wp\/v2\/media\/519"}],"wp:attachment":[{"href":"https:\/\/windabaft.co.jp\/blog_ceo\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=517"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/windabaft.co.jp\/blog_ceo\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=517"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/windabaft.co.jp\/blog_ceo\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=517"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}