{"id":3227,"date":"2018-05-24T23:25:29","date_gmt":"2018-05-24T14:25:29","guid":{"rendered":"http:\/\/www.code-magagine.com\/?p=3227"},"modified":"2023-05-27T21:27:52","modified_gmt":"2023-05-27T12:27:52","slug":"%e3%80%90linux%e3%80%91%e3%80%8csu%e3%80%8d%e3%81%a8%e3%80%8csudo%e3%80%8d%e3%81%ae%e9%81%95%e3%81%84","status":"publish","type":"post","link":"http:\/\/www.code-magagine.com\/?p=3227","title":{"rendered":"\u3010Linux\u3011\u300csu\u300d\u3068\u300csudo\u300d\u306e\u9055\u3044"},"content":{"rendered":"<h2>su(\u300cSwitch User\uff1a\u30e6\u30fc\u30b6\u30fc\u3092\u5207\u308a\u66ff\u3048\u308b\u300d\u306e\u7565\uff09<\/h2>\n<p>\u30e6\u30fc\u30b6\u30fc\u3092\u5207\u308a\u66ff\u3048\u308b\u30b3\u30de\u30f3\u30c9\u3067\u3059\u3002\u30b9\u30fc\u30d1\u30fc\u30e6\u30fc\u30b6\u306b\u306a\u308b\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"lang:default decode:true\">su - (\u30e6\u30fc\u30b6\u30fc\u540d)<\/pre>\n<p><span style=\"color: #ff0000;\"><strong>\u30e6\u30fc\u30b6\u30fc\u540d\u3092\u7701\u7565\u3057\u305f\u5834\u5408\u306f\u3001\u30b9\u30fc\u30d1\u30fc\u30e6\u30fc\u30b6\u30fc(\u30eb\u30fc\u30c8\u30e6\u30fc\u30b6\u30fc)\u306b\u306a\u308a\u307e\u3059\u3002<\/strong><\/span><\/p>\n<p>\u5fc5\u8981\u306a\u4f5c\u696d\u3092\u884c\u3063\u305f\u5f8c\u306bexit\u3084\u3001logout\u3067\u5143\u306e\u30e6\u30fc\u30b6\u30fc\u306b\u623b\u308b\u306e\u304c\u4e00\u822c\u7684\u3067\u3059\u3002<\/p>\n<h3>\u300csu\u300d\u3068\u300csu -\u300d\u306e\u9055\u3044<\/h3>\n<p><span style=\"color: #ff0000;\"><strong>su\u30b3\u30de\u30f3\u30c9\u306f\u3001\u300c-(\u30cf\u30a4\u30d5\u30f3)\u300d\u3092\u4ed8\u3051\u308b\u5834\u5408\u3068\u3001\u3064\u3051\u306a\u3044\u5834\u5408\u3067\u610f\u5473\u304c\u304b\u306a\u308a\u7570\u306a\u3063\u3066\u304d\u307e\u3059\u306e\u3067\u3001\u6ce8\u610f<\/strong><\/span>\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n<h4>\u300csu\u300d<\/h4>\n<p>\u4e00\u822c\u30e6\u30fc\u30b6\u30fc\u306e\u74b0\u5883\uff08\u74b0\u5883\u5909\u6570\u3001\u30b7\u30a7\u30eb\u5909\u6570\u7b49\uff09\u306f<strong>\u3001<\/strong>\u7121\u6761\u4ef6\u3067\u6307\u5b9a\u3057\u305f\u30e6\u30fc\u30b6\u30fc\u306b\u5f15\u304d\u7d99\u304c\u308c\u307e\u3059\u3002<\/p>\n<p>\u4f8b\u3048\u3070Java\u3084Oracle\u7b49\u3092\u4f7f\u3063\u3066\u3044\u308b\u5834\u5408\u306b\u3001\u300cJAVA_HOME\u300d\u3001\u300cOracle_HOME\u300d\u7b49\u306e\u74b0\u5883\u5909\u6570\u3092\u5229\u7528\u3057\u305f\u30b7\u30a7\u30eb\u3092\u52d5\u304b\u3057\u305f\u3044\u3068\u3044\u3063\u305f\u5834\u5408\u7b49\u306b\u306f\u5f71\u97ff\u3092\u51fa\u3059\u3053\u3068\u306a\u304f\u5b9f\u884c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u307e\u305f\u3001\u30db\u30fc\u30e0\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306f\u3001<span style=\"color: #ff0000;\"><strong>\u300chome\u300d\u306b\u3042\u308b\u3082\u306e\u304c\u305d\u306e\u307e\u307e\u5f15\u304d\u7d99\u304c\u308c\u307e\u3059\u3002<\/strong><\/span><\/p>\n<h4>\u300csu -\u300d\u306e\u5834\u5408<\/h4>\n<p>\u4e00\u822c\u30e6\u30fc\u30b6\u30fc\u306e\u74b0\u5883\uff08\u74b0\u5883\u5909\u6570\u3001\u30b7\u30a7\u30eb\u5909\u6570\u7b49\uff09\u306froot\u306b\u306a\u308b\u3002<\/p>\n<p>\u307e\u305f\u3001\u30db\u30fc\u30e0\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306f\u3001<span style=\"color: #ff0000;\"><strong>\u300croot\u300d<\/strong><\/span>\u306e\u3082\u306e\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<h2>sudo(\u300cSuper User DO\uff1a\u30b9\u30fc\u30d1\u30fc\u30e6\u30fc\u30b6\u30fc\u3067\u5b9f\u884c\u300d\u306e\u7565\uff09<\/h2>\n<p>\u300cSuper User Do\u300d\u3068\u3044\u3046\u8aad\u3093\u3067\u5b57\u306e\u3054\u3068\u304f\u3001<span style=\"color: #ff0000;\"><strong>\u300c\u30b9\u30fc\u30d1\u30fc\u30e6\u30fc\u30b6\u30fc\u3067\u5b9f\u884c\u3059\u308b\u300d<\/strong><\/span>\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u4f8b<\/p>\n<pre class=\"lang:default decode:true\">sudo ls -la<\/pre>\n<p>\u30b3\u30de\u30f3\u30c9\u5b9f\u884c\u306e\u90fd\u5ea6\u6a29\u9650\u3092\u4e0e\u3048\u308b\u306e\u3067\u3001<span style=\"color: #ff0000;\"><strong>\u30b3\u30de\u30f3\u30c9\u5b9f\u884c\u5b8c\u4e86\u5f8c\u306f\u6a29\u9650\u304c\u5143\u306b\u623b\u308a\u307e\u3059\u3002<\/strong><\/span><\/p>\n<p>\u305f\u3060\u3001\u74b0\u5883\u5909\u6570\u306fsu\u3068\u9055\u3063\u3066\u3001\u30c7\u30d5\u30a9\u30eb\u30c8\u3067\u306f\u5f15\u304d\u7d99\u304c\u308c\u306a\u3044\u306e\u3067\u3001\u74b0\u5883\u5909\u6570\u3092\u4f7f\u3063\u305f\u30b7\u30a7\u30eb\u3092\u52d5\u304b\u3059\u5834\u5408\u7b49\u306b\u306f\u6ce8\u610f\u3067\u3059\u3002<\/p>\n<p>\u307e\u305f\u3001\u30d1\u30b9\u30ef\u30fc\u30c9\u306f\u968f\u6642\u6c42\u3081\u3089\u308c\u307e\u3059\u304c\u3001<span style=\"color: #ff0000;\"><strong>\u4e00\u822c\u30e6\u30fc\u30b6\u30fc\u306e\u30d1\u30b9\u30ef\u30fc\u30c9\u306e\u5165\u529b\u3067\u3001\u7ba1\u7406\u8005\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3067\u304d\u308b\u3068\u3044\u3046\u306e\u3082su\u3068\u306e\u5927\u304d\u306a\u9055\u3044<\/strong><\/span>\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n<h2>su\u3068sudo\u306e\u4f7f\u3044\u5206\u3051\u306f\u3069\u306e\u3088\u3046\u306b\u884c\u3048\u3070\u3088\u3044\u306e\u304b\uff1f<\/h2>\n<ul>\n<li>\u300c\/etc\/sudoers\u300d\u3067\u6a29\u9650\u3092\u7d30\u304b\u304f\u8a2d\u5b9a\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u306e\u3067\u3001<span style=\"color: #ff0000;\"><strong>\u6700\u8fd1\u306f\u6a29\u9650\u3092\u6c7a\u3081\u7d30\u3084\u304b\u306b\u8a2d\u5b9a\u3059\u308b\u305f\u3081\u306b\u300csu\u300d\u306f\u7981\u6b62\u3057\u3066\u3001\u300csudo\u300d\u306b\u7d71\u4e00\u3057\u3066\u3044\u308b\u73fe\u5834\u3082\u591a\u3044<\/strong><\/span>\u3067\u3059\u3002<\/li>\n<li>root\u306e\u30d1\u30b9\u30ef\u30fc\u30c9\u304c\u8a2d\u5b9a\u3055\u308c\u3066\u3044\u306a\u304b\u3063\u305f\u308a\u3001\u308f\u304b\u3089\u306a\u3044\u5834\u5408\u3082\u3001sudo\u30b3\u30de\u30f3\u30c9\u3092\u4f7f\u3044\u307e\u3059\u3002<\/li>\n<li>\u958b\u767a\u5143\u304c\u5225\u306b\u306a\u308a\u307e\u3059\u3002su\u306f\u300cutil-linux\u30d1\u30c3\u30b1\u30fc\u30b8\u300d\u306b\u542b\u307e\u308c\u3066\u3044\u3066\u3001sudo\u306f\u300csudo\u30d1\u30c3\u30b1\u30fc\u30b8\u300d\u306b\u542b\u307e\u308c\u3066\u3044\u307e\u3059\u3002\uff08\u6a5f\u80fd\u7684\u306b\u306f\u4f3c\u305f\u3088\u3046\u306a\u3082\u306e\u3067\u3059\u304c\u30bd\u30fc\u30b9\u306f\u5168\u304f\u5225\u7269\u306b\u306a\u308a\u307e\u3059\u3002\uff09\u3001su\u306fUnix\u521d\u671f\u304b\u3089\u4f5c\u3089\u308c\u3066\u3044\u3066sudo\u306e\u65b9\u304c\u5f8c\u767a\u306b\u306a\u308a\u307e\u3059\u3002<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"su(\u300cSwitch User\uff1a\u30e6\u30fc\u30b6\u30fc\u3092\u5207\u308a\u66ff\u3048\u308b\u300d\u306e\u7565\uff09 \u30e6\u30fc\u30b6\u30fc\u3092\u5207\u308a\u66ff\u3048\u308b\u30b3\u30de\u30f3\u30c9\u3067\u3059\u3002\u30b9\u30fc\u30d1\u30fc\u30e6\u30fc\u30b6\u306b\u306a\u308b\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u3002 su - (\u30e6\u30fc\u30b6\u30fc\u540d) \u30e6\u30fc\u30b6\u30fc\u540d\u3092\u7701\u7565\u3057\u305f\u5834\u5408\u306f\u3001\u30b9\u30fc\u30d1\u30fc\u30e6\u30fc\u30b6\u30fc(\u30eb\u30fc\u30c8\u30e6\u30fc\u30b6\u30fc [&hellip;]","protected":false},"author":1,"featured_media":2965,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[39],"tags":[],"_links":{"self":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts\/3227"}],"collection":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3227"}],"version-history":[{"count":20,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts\/3227\/revisions"}],"predecessor-version":[{"id":20361,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts\/3227\/revisions\/20361"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/media\/2965"}],"wp:attachment":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3227"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3227"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3227"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}