{"id":1066,"date":"2017-11-03T12:00:00","date_gmt":"2017-11-03T03:00:00","guid":{"rendered":"https:\/\/hi3103.net\/notes\/?p=1066"},"modified":"2022-07-09T23:33:51","modified_gmt":"2022-07-09T14:33:51","slug":"%e3%81%95%e3%81%8f%e3%82%89vps%e3%82%b5%e3%83%bc%e3%83%90%e3%83%bc%e5%88%9d%e6%9c%9f%e8%a8%ad%e5%ae%9a","status":"publish","type":"post","link":"https:\/\/hi3103.net\/notes\/web\/1066","title":{"rendered":"\u3055\u304f\u3089VPS\u30b5\u30fc\u30d0\u30fc\u521d\u671f\u8a2d\u5b9a"},"content":{"rendered":"<h4>\u53c2\u8003URL<\/h4>\n<ul>\n<li><a href=\"https:\/\/knowledge.sakura.ad.jp\/8218\/\">\u30cd\u30b3\u3067\u3082\u308f\u304b\u308b\uff01\u3055\u304f\u3089\u306eVPS\u8b1b\u5ea7 \uff5e\u7b2c\u4e8c\u56de\u300c\u30b5\u30fc\u30d0\u30fc\u3092\u3055\u308f\u3063\u3066\u307f\u3088\u3046\uff01\u300d<\/a><\/li>\n<li><a href=\"http:\/\/www.tooyama.org\/centos_1st.html\">CentOS \u521d\u671f\u8a2d\u5b9a<\/a>\n<ul>\n<li><a href=\"http:\/\/www.garunimo.com\/program\/linux\/visudo.xhtml\">visudo\u30b3\u30de\u30f3\u30c9\uff08sudo\u30b3\u30de\u30f3\u30c9\u306e\u70ba\u306e\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u306e\u7de8\u96c6\uff09<\/a><\/li>\n<\/ul>\n<\/li>\n<li><a href=\"http:\/\/www.tooyama.org\/ssh-key.html\">ssh\u63a5\u7d9a\u3092\u9375\u8a8d\u8a3c\u3067\u884c\u3046<\/a><\/li>\n<\/ul>\n<p><!--more--><\/p>\n<h4>\u30b5\u30fc\u30d0\u30fc\u3078\u306essh\u63a5\u7d9a\u3068\u30e6\u30fc\u30b6\u30fc\u8a2d\u5b9a<\/h4>\n<h5>root\u3067ssh\u63a5\u7d9a<\/h5>\n<pre><code class=\"language-sh\">$ ssh root@{IP\u30a2\u30c9\u30ec\u30b9}<\/code><\/pre>\n<h5>CentOS\u30a2\u30c3\u30d7\u30c7\u30fc\u30c8<\/h5>\n<pre><code class=\"language-sh\"># yum update<\/code><\/pre>\n<h5>\u4e00\u822c\u30e6\u30fc\u30b6\u30fc\u306e\u4f5c\u6210<\/h5>\n<pre><code class=\"language-sh\"># adduser {\u30e6\u30fc\u30b6\u30fc\u540d}<\/code><\/pre>\n<h5>\u30e6\u30fc\u30b6\u30fc\u306e\u30d1\u30b9\u30ef\u30fc\u30c9\u3092\u8a2d\u5b9a<\/h5>\n<pre><code class=\"language-sh\"># passwd {\u30e6\u30fc\u30b6\u30fc\u540d}<\/code><\/pre>\n<h5>\u4f5c\u6210\u3057\u305f\u4e00\u822c\u30e6\u30fc\u30b6\u30fc\u3067ssh\u63a5\u7d9a\u3057\u3001root\u306b\u5207\u308a\u66ff\u3048\u308b<\/h5>\n<pre><code class=\"language-sh\"># ssh {\u30e6\u30fc\u30b6\u30fc\u540d}@{IP\u30a2\u30c9\u30ec\u30b9}\n# su<\/code><\/pre>\n<h4>\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u3092\u9ad8\u3081\u308b\u305f\u3081\u306e\u6a29\u9650\u8a2d\u5b9a<\/h4>\n<h5>root\u304b\u3089\u306essh\u63a5\u7d9a\u3092\u7981\u6b62\u3059\u308b<\/h5>\n<ul>\n<li>\/etc\/ssh\/sshd_config\u3092\u4e0b\u8a18\u306e\u901a\u308a\u7de8\u96c6\u3057\u3001sshd\u3092\u518d\u8d77\u52d5\n<ul>\n<li>\u524d\uff1a<code>#PermitRootLogin yes<\/code><\/li>\n<li>\u5f8c\uff1a<code>PermitRootLogin no<\/code><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<pre><code class=\"language-sh\"># cd \/etc\/ssh \/\/\u79fb\u52d5\n# cp sshd_config sshd_config.bak \/\/BAK\u3092\u3068\u3063\u3066\u304a\u304f\n# vi sshd_config \/\/\u7de8\u96c6\n# systemctl restart sshd.service \/\/\u518d\u8d77\u52d5<\/code><\/pre>\n<h5>\u4f5c\u6210\u3057\u305f\u4e00\u822c\u30e6\u30fc\u30b6\u30fc\u3092wheel\u30b0\u30eb\u30fc\u30d7\u306b\u8ffd\u52a0\u3059\u308b<\/h5>\n<pre><code class=\"language-sh\"># gpasswd -a {\u30e6\u30fc\u30b6\u30fc\u540d} wheel<\/code><\/pre>\n<pre><code>Usage: gpasswd [option] GROUP\n\nOptions:\n  -a, --add USER                add USER to GROUP\n  -d, --delete USER             remove USER from GROUP\n  -h, --help                    display this help message and exit\n  -Q, --root CHROOT_DIR         directory to chroot into\n  -r, --delete-password         remove the GROUP's password\n  -R, --restrict                restrict access to GROUP to its members\n  -M, --members USER,...        set the list of members of GROUP\n  -A, --administrators ADMIN,...\n                                set the list of administrators for GROUP\nExcept for the -A and -M options, the options cannot be combined.<\/code><\/pre>\n<ul>\n<li>\u6240\u5c5e\u30b0\u30eb\u30fc\u30d7\u306fid\u30b3\u30de\u30f3\u30c9\u304bgropus\u30b3\u30de\u30f3\u30c9\u3067\u78ba\u8a8d\u3067\u304d\u308b\n<ul>\n<li>\u4f8b\uff1a\u30e6\u30fc\u30b6\u30fc\u540d\u304c hoge \u306e\u5834\u5408<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<pre><code class=\"language-sh\"># id hoge\nuid=1000(hoge) gid=1000(hoge) groups=1000(hoge),10(wheel)<\/code><\/pre>\n<pre><code class=\"language-sh\"># groups hoge\nhoge : hoge wheel<\/code><\/pre>\n<h5>root\u6a29\u9650\u306b\u5207\u308a\u66ff\u3048\u3089\u308c\u308b\u30e6\u30fc\u30b6\u30fc\u3092wheel\u30b0\u30eb\u30fc\u30d7\u306b\u6240\u5c5e\u3059\u308b\u30e6\u30fc\u30b6\u30fc\u306e\u307f\u306b\u5236\u9650\u3059\u308b<\/h5>\n<ul>\n<li>\/etc\/pam.d\/su\u3092\u7de8\u96c6\n<ul>\n<li>\u4e0b\u8a182\u884c\u76ee\u306e\u30b3\u30e1\u30f3\u30c8\u30a2\u30a6\u30c8\u3092\u5916\u3059<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<pre><code class=\"language-sh\"># vi \/etc\/pam.d\/su<\/code><\/pre>\n<pre><code class=\"language-vim\"># Uncomment the following line to require a user to be in the \"wheel\" group.\n#auth            required        pam_wheel.so use_uid<\/code><\/pre>\n<h5>wheel\u30b0\u30eb\u30fc\u30d7\u306b\u6240\u5c5e\u3059\u308b\u30e6\u30fc\u30b6\u30fc\u306f\u30d1\u30b9\u30ef\u30fc\u30c9\u306a\u3057\u3067root\u3078\u5207\u66ff\u53ef\u80fd\u306b\u3059\u308b<\/h5>\n<ul>\n<li>\/etc\/pam.d\/su\u3092\u7de8\u96c6\n<ul>\n<li>\u4e0b\u8a182\u884c\u76ee\u306e\u30b3\u30e1\u30f3\u30c8\u30a2\u30a6\u30c8\u3092\u5916\u3059<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<pre><code class=\"language-sh\"># vi \/etc\/pam.d\/su<\/code><\/pre>\n<pre><code class=\"language-vim\"># Uncomment the following line to implicitly trust users in the \"wheel\" group.\n#auth            sufficient      pam_wheel.so trust use_uid<\/code><\/pre>\n<h5>wheel\u30b0\u30eb\u30fc\u30d7\u306b\u6240\u5c5e\u3059\u308b\u30e6\u30fc\u30b6\u30fc\u306fsudo\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u53ef\u80fd\u306b\u3059\u308b<\/h5>\n<ul>\n<li>visudo\u30b3\u30de\u30f3\u30c9\u3092\u4f7f\u3063\u3066sudoers\u30d5\u30a1\u30a4\u30eb\uff08sudo\u30b3\u30de\u30f3\u30c9\u306e\u305f\u3081\u306e\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\uff09\u3092\u4e0b\u8a18\u306e\u901a\u308a\u7de8\u96c6\n<ul>\n<li>\u4e0b\u8a182\u884c\u76ee\u306e\u30b3\u30e1\u30f3\u30c8\u30a2\u30a6\u30c8\u3092\u5916\u3059<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<pre><code class=\"language-sh\"># visudo<\/code><\/pre>\n<pre><code class=\"language-vim\">## Same thing without a password\n# %wheel        ALL=(ALL)       NOPASSWD: ALL<\/code><\/pre>\n<h4>ssh\u63a5\u7d9a\u3092\u9375\u8a8d\u8a3c\u3067\u884c\u3046<\/h4>\n<ul>\n<li>\u3042\u3068\u3067\u3084\u308b<\/li>\n<\/ul>\n<h4>\u3057\u3070\u3089\u304f\u4f7f\u308f\u306a\u3044\u3068\u304d\u306f\u30b5\u30fc\u30d0\u30fc\u3092\u505c\u6b62\u3057\u3066\u304a\u304f<\/h4>\n<pre><code class=\"language-sh\"># shutdown -h now<\/code><\/pre>\n<pre><code>shutdown [OPTIONS...] [TIME] [WALL...]\n\nShut down the system.\n\n     --help      Show this help\n  -H --halt      Halt the machine\n  -P --poweroff  Power-off the machine\n  -r --reboot    Reboot the machine\n  -h             Equivalent to --poweroff, overridden by --halt\n  -k             Don't halt\/power-off\/reboot, just send warnings\n     --no-wall   Don't send wall message before halt\/power-off\/reboot\n  -c             Cancel a pending shutdown<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u53c2\u8003URL \u30cd\u30b3\u3067\u3082\u308f\u304b\u308b\uff01\u3055\u304f\u3089\u306eVPS\u8b1b\u5ea7 \uff5e\u7b2c\u4e8c\u56de\u300c\u30b5\u30fc\u30d0\u30fc\u3092\u3055\u308f\u3063\u3066\u307f\u3088\u3046\uff01\u300d CentOS \u521d\u671f\u8a2d\u5b9a visudo\u30b3\u30de\u30f3\u30c9\uff08sudo\u30b3\u30de\u30f3\u30c9\u306e\u70ba\u306e\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u306e\u7de8\u96c6\uff09 ssh\u63a5\u7d9a\u3092\u9375\u8a8d\u8a3c\u3067\u884c\u3046<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[53],"tags":[26,15,48],"class_list":["post-1066","post","type-post","status-publish","format-standard","hentry","category-web","tag-centos7","tag-terminal","tag-server"],"_links":{"self":[{"href":"https:\/\/hi3103.net\/notes\/wp-json\/wp\/v2\/posts\/1066","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hi3103.net\/notes\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hi3103.net\/notes\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hi3103.net\/notes\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/hi3103.net\/notes\/wp-json\/wp\/v2\/comments?post=1066"}],"version-history":[{"count":0,"href":"https:\/\/hi3103.net\/notes\/wp-json\/wp\/v2\/posts\/1066\/revisions"}],"wp:attachment":[{"href":"https:\/\/hi3103.net\/notes\/wp-json\/wp\/v2\/media?parent=1066"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hi3103.net\/notes\/wp-json\/wp\/v2\/categories?post=1066"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hi3103.net\/notes\/wp-json\/wp\/v2\/tags?post=1066"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}