{"id":157041,"date":"2019-09-03T11:47:52","date_gmt":"2019-09-03T03:47:52","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=157041"},"modified":"2019-08-30T09:49:12","modified_gmt":"2019-08-30T01:49:12","slug":"laravel-permission-denied","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/laravel-permission-denied.html","title":{"rendered":"Laravel\u65e5\u5fd7\u6587\u4ef6\u5199\u5165\u5931\u8d25\uff08permission denied\uff09"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\n\u7528\u8fc7Laravel\u7684\u5c0f\u4f19\u4f34\u4e00\u5f00\u59cb\u5b89\u88c5\u5b8c\u6846\u67b6\u540e\u53ef\u80fd\u90fd\u9047\u5230\u8fc7daily \u65e5\u5fd7\u6587\u4ef6\u5199\u5165\u5931\u8d25\u7684\u95ee\u9898\uff0c\u63a5\u4e0b\u6765\u6211\u4eec\u5c31\u6765\u8be6\u7ec6\u8bf4\u4e0b\u65e5\u5fd7\u6587\u4ef6\u5199\u5165\u5931\u8d25\u7684\u539f\u56e0\u4ee5\u53ca\u5bf9\u5e94\u7684\u89e3\u51b3\u65b9\u6848\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

\u5728\u8bb2\u8fd9\u4e2a\u95ee\u9898\u4e4b\u524d\u53ef\u80fd\u9700\u8981\u7b80\u5355\u4ecb\u7ecd\u4e0bLinux\u7cfb\u7edf\u4e0b\u7684\u6587\u4ef6\u7684Ownership\u548cPermission\u3002<\/p>\n

\u2022Ownership <\/strong><\/div>\n
\u25e6User<\/strong><\/span><\/div>\n

User\u662f\u6587\u4ef6\u7684\u6240\u6709\u8005\uff0c\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u7528\u6237\u521b\u5efa\u4e86\u4e00\u4e2a\u6587\u4ef6\uff0c\u8be5\u6587\u4ef6\u7684\u6240\u6709\u8005\u5c31\u662f\u8be5\u7528\u6237\u3002<\/p>\n

\u25e6Group<\/strong><\/span><\/div>\n

\u4e00\u4e2a\u7528\u6237\u7ec4\u80fd\u5305\u542b\u591a\u4e2a\u7528\u6237\uff0c\u6240\u6709\u5c5e\u4e8e\u8fd9\u4e2a\u7ec4\u7684\u7528\u6237\u90fd\u6709\u76f8\u540c\u7684\u6743\u9650\u6765\u8bbf\u95ee\u6587\u4ef6\u3002\u5047\u8bbe\u4f60\u6709\u4e00\u4e2a\u9879\u76ee\uff0c\u5f88\u591a\u7528\u6237\u90fd\u9700\u8981\u8bbf\u95ee\u8fd9\u4e2a\u9879\u76ee\u6587\u4ef6\u7684\u6743\u9650\uff0c\u4f60\u4e0d\u9700\u8981\u624b\u52a8\u8d4b\u4e88\u8fd9\u4e9b\u7528\u6237\u6240\u6709\u6743\u9650\uff0c\u4f60\u53ea\u9700\u8981\u628a\u8fd9\u4e9b\u7528\u6237\u52a0\u5230\u4e00\u4e2a\u7ec4\u91cc\u9762\uff0c\u8d4b\u4e88\u8fd9\u4e9b\u7ec4\u6709\u8bbf\u95ee\u6587\u4ef6\u7684\u6743\u9650\uff0c\u8fd9\u6837\u4e00\u6765\u5c31\u4ec5\u4ec5\u53ea\u6709\u7ec4\u91cc\u9762\u7684\u6210\u5458\u80fd\u5bf9\u6587\u4ef6\u8fdb\u884c\u8bfb\u5199\u64cd\u4f5c\u3002<\/p>\n

\u25e6Other<\/strong><\/span><\/div>\n

\u4efb\u4f55\u5176\u4ed6\u7684\u7528\u6237\u90fd\u80fd\u8bbf\u95ee\u6587\u4ef6\uff0c\u56e0\u6b64\uff0c\u7ed9Other\u7528\u6237\u8d4b\u4e88\u6743\u9650\uff0c\u76f8\u5f53\u4e8e\u6240\u6709\u7528\u6237\u90fd\u62e5\u6709\u8fd9\u4e2a\u6743\u9650\u3002<\/p>\n

\u2022Permission<\/strong><\/div>\n

\u5728 UNIX\/Linux \u7cfb\u7edf\u4e2d\u6bcf\u4e00\u4e2a\u6587\u4ef6\u548c\u76ee\u5f55\u90fd\u67093\u4e2d\u6743\u9650\uff0c\u4ee5\u4e0b\u5c31\u662f\u5bf9\u4e09\u4e2a\u6240\u6709\u8005\u7684\u8ba8\u8bba\u3002<\/p>\n

    \n
  • \u25e6Read\uff1a\u8fd9\u4e2a\u6743\u9650\u8d4b\u4e88\u4f60\u6253\u5f00\u548c\u8bfb\u53d6\u6587\u4ef6\u7684\u6743\u9650\u3002\u62e5\u6709\u76ee\u5f55\u7684\u8bfb\u6743\u9650\uff0c\u4f60\u80fd\u5217\u51fa\u5176\u5185\u5bb9\u3002<\/li>\n
  • \u25e6Write\uff1a\u62e5\u6709\u4e86\u8bfb\u6743\u9650\uff0c\u4f60\u80fd\u4fee\u6539\u6587\u4ef6\u7684\u5185\u5bb9\u3002\u62e5\u6709\u4e86\u76ee\u5f55\u7684\u5199\u6743\u9650\uff0c\u4f60\u80fd\u6dfb\u52a0\u3001\u79fb\u9664\u4ee5\u53ca\u91cd\u547d\u540d\u8be5\u76ee\u5f55\u4e0b\u7684\u6587\u4ef6\u3002\u8003\u8651\u4e00\u79cd\u573a\u666f\uff0c\u5f53\u4f60\u62e5\u6709\u6587\u4ef6\u7684\u5199\u6743\u9650\uff0c\u4f46\u662f\u6ca1\u6709\u6587\u4ef6\u5b58\u50a8\u76ee\u5f55\u7684\u5199\u6743\u9650\uff0c\u4f60\u8fd8\u662f\u80fd\u4fee\u6539\u6587\u4ef6\u7684\u5185\u5bb9\uff0c\u4f46\u4e0d\u80fd\u91cd\u547d\u540d\u3001\u79fb\u52a8\u4ee5\u53ca\u79fb\u9664\u76ee\u5f55\u4e0b\u7684\u6587\u4ef6\u3002<\/li>\n
  • \u25e6Execute\uff1a\u5728Windows\u7cfb\u7edf\u4e2d\uff0c\u4e00\u4e2a\u53ef\u6267\u884c\u7684\u7a0b\u5e8f\u901a\u5e38\u90fd\u6709.exe\u540e\u7f00\uff0c\u4f60\u80fd\u5f88\u65b9\u4fbf\u7684\u8fd0\u884c\u5b83\u3002\u5728 UNIX\/Linux \u4e2d\uff0c\u9664\u975e\u88ab\u8d4b\u4e88\u53ef\u6267\u884c\u6743\u9650\uff0c\u5426\u5219\u4f60\u5c06\u4e0d\u80fd\u8fd0\u884c\u8be5\u7a0b\u5e8f\u3002\u5982\u679c\u672a\u6388\u6743\u53ef\u6267\u884c\u6743\u9650\uff0c\u4f60\u8ba9\u7136\u53ef\u4ee5\u770b\u5e76\u4fee\u6539\u7a0b\u5e8f\u4ee3\u7801\uff08\u88ab\u6388\u4e88\u8bfb\u548c\u5199\u6743\u9650\uff09\uff0c\u4f46\u662f\u65e0\u6cd5\u8fd0\u884c\u5b83\u3002<\/li>\n<\/ul>\n

    linux\u4e0b\u6587\u4ef6\u4fe1\u606f\u7684\u663e\u793a\u622a\u56fe
    \n\"\"
    \nlinux\u4e0b\u76ee\u5f55\u7684\u4fe1\u606f\u663e\u793a\u622a\u56fe
    \n\"\"
    \n\u4ee5\u4e0a\u7684\u622a\u56fe\u663e\u793a\u4e86\u4e00\u4e2a\u6587\u4ef6\u548c\u6587\u4ef6\u5939\u7684\u4fe1\u606f\uff0c\u6211\u4eec\u53ef\u4ee5\u770b\u5230\uff1a<\/p>\n

      \n
    • \u2022r \u4ee3\u8868\u53ef\u8bfb\uff0c w \u4ee3\u8868\u53ef\u5199\uff0c x \u4ee3\u8868\u53ef\u6267\u884c\u3002<\/li>\n
    • \u2022\u7b2c\u4e00\u4f4d\u6587\u4ef6\u663e\u793a - \uff0c\u6587\u4ef6\u663e\u793a d \u3002<\/li>\n
    • \u2022\u4e0a\u9762\u7b2c\u4e00\u5f20\u56fe\u7247\uff0c rw-rw-r-\u2014 \u4e2d\u3002\u7b2c\u4e00\u7ec4 rw- \u8868\u793a\u6587\u4ef6\u7684\u6240\u6709\u8005\u5bf9\u6587\u4ef6\u6709\u53ef\u8bfb\u3001\u53ef\u5199\u3001\u4e0d\u53ef\u6267\u884c\u7684\u6743\u9650\u3002\u7b2c\u4e8c\u7ec4 rw- \u8868\u793a\u6587\u4ef6\u6240\u5c5e\u7684\u7ec4\u5185\u7528\u6237\u5bf9\u8be5\u6587\u4ef6\u6709\u53ef\u8bfb\u3001\u53ef\u5199\u3001\u4e0d\u53ef\u6267\u884c\u7684\u6743\u9650\u3002\u7b2c\u4e09\u7ec4 r-\u2014 \u8868\u793a\u5176\u4ed6\u4efb\u4f55\u7528\u6237\u5bf9\u8be5\u6587\u4ef6\u6709\u53ef\u8bfb\u3001\u4e0d\u53ef\u5199\u3001\u4e0d\u53ef\u6267\u884c\u7684\u6743\u9650\u3002<\/li>\n
    • \u2022rw-rw-r-- \u7528\u4e8c\u8fdb\u5236\u8868\u793a\u4e3a 664 \uff0c\u6bcf\u4e00\u4f4d\u5982\u6709\u6743\u9650\u5219\u4e3a 1 \uff0c\u5426\u5219\u4e3a 0 \uff0c\u7b2c\u4e00\u4e2a\u4e09\u4f4d rw- \u7528\u4e8c\u8fdb\u5236\u8868\u793a\u4e3a 110 \u8f6c\u5316\u4e3a\u5341\u8fdb\u5236\u5c31\u662f 6\uff0c\u540e\u9762\u4e24\u7ec4\u4f9d\u6b21\u7c7b\u63a8\uff0c\u6700\u540e\u5f97\u5230 664 \u3002<\/li>\n
    • \u2022\u4e0a\u9762\u7b2c\u4e00\u5f20\u56fe\u7247\u7684 dior www-data \u8868\u793a\u8be5\u6587\u4ef6\u7684\u6240\u6709\u8005\u662f dior \u7528\u6237\uff0c\u6587\u4ef6\u5c5e\u4e8e www-data \u7ec4\u3002<\/li>\n<\/ul>\n

      \u6211\u4eec\u77e5\u9053\u5f88\u591a\u5e94\u7528\u7cfb\u7edf\u4e2d\u7684\u65e5\u5fd7\u662f\u5199\u6587\u4ef6\u7684\uff0c\u4e14\u662f\u4ee5\u65e5\u671f\u6765\u547d\u540d\u6587\u4ef6\u7684\u3002\u6240\u4ee5\u7b2c\u4e00\u6b21\u521b\u5efa\u65e5\u5fd7\u7684\u7528\u6237\u5c31\u663e\u5f97\u5c24\u4e3a\u91cd\u8981\uff0c\u5982\u679c\u6587\u4ef6\u521b\u5efa\u7684 Onwer\u548c Group \u4e0d\u5bf9\uff0c\u5176\u4ed6\u7684\u7528\u6237\u89e6\u53d1\u5199\u5165\u65e5\u5fd7\u6587\u4ef6\u5c31\u4f1a\u5931\u8d25\u3002<\/p>\n

      \u63a5\u4e0b\u6765\u6211\u4eec\u8ba8\u8bba\u4e0b\u6709\u591a\u5c11\u79cd\u4e0d\u540c\u7684\u7528\u6237\u53ef\u80fd\u521b\u5efa\u65e5\u5fd7\u6587\u4ef6\uff1a<\/p>\n

        \n
      • \u2022Crontab\u4e2d\u6267\u884c\u7684\u5b9a\u65f6\u4efb\u52a1\uff0c\u8ddf\u521b\u5efa Crontab \u7684\u7528\u6237\u6709\u5173\uff0c\u6b64\u65f6\u521b\u5efa\u7684\u6587\u4ef6 Owner \u548c Group \u503c\u5206\u522b\u662f\u8be5\u7528\u6237\u4ee5\u53ca\u9ed8\u8ba4\u7684 Group \u3002<\/li>\n
      • \u2022\u4e00\u4e9b\u5e38\u9a7b\u7684\u540e\u53f0\u8fdb\u7a0b\uff0c\u6bd4\u5982Laravel\u4e2d\u7684 queue work \uff0c\u6b64\u65f6\u521b\u5efa\u7684\u65e5\u5fd7\u6587\u4ef6 Owner \u548c Group \u503c\u5206\u522b\u662f\u6267\u884c\u8be5\u8fdb\u7a0b\u7684\u7528\u6237\u4ee5\u53ca\u6240\u5c5e\u7684\u9ed8\u8ba4 Group \u3002<\/li>\n
      • \u2022\u6b63\u5e38\u7528\u6237\u8bbf\u95ee\u7f51\u7ad9\u4ea7\u751f\u7684\u65e5\u5fd7\u6587\u4ef6\uff0c\u6b64\u65f6\u521b\u5efa\u7684\u65e5\u5fd7\u6587\u4ef6\u7684 Owner \u548c Group \u90fd\u662f www-data \uff0c www-data \u7528\u6237\u662fweb\u670d\u52a1\u5668\u9ed8\u8ba4\u7684\u7528\u6237\u3002<\/li>\n<\/ul>\n

        \u7531\u4ee5\u4e0a\u7684\u5206\u6790\uff0c\u6211\u4eec\u5927\u6982\u5df2\u7ecf\u627e\u5230\u4e86\u89e3\u51b3\u95ee\u9898\u7684\u65b9\u6cd5\u3002<\/p>\n

          \n
        • \u2022\u6267\u884c\u7528\u6237\u521b\u5efa\u65e5\u5fd7\u6587\u4ef6\u7684\u6743\u9650\u4e3a 664 \u6bd4\u8f83\u6070\u5f53\uff0c\u8fd9\u5c31\u9700\u8981\u5f53\u524d\u7528\u6237\u7684umask\u4e3a 0002 \u3002<\/li>\n
        • \u2022\u5f53\u524d\u6267\u884c\u7528\u6237\u7684\u9ed8\u8ba4 Group \u5e94\u8be5\u8bbe\u7f6e\u4e3a www-data \u3002<\/li>\n<\/ul>\n

          \u4e0b\u9762\u5c31\u8bf4\u4e0b\u6211\u7684\u5177\u4f53\u89e3\u51b3\u65b9\u6848\uff1a<\/p>\n

          \u6307\u5b9awww-data\u7528\u6237\u6267\u884ccrontab\uff1a<\/p>\n

          \r\nsudo crontab -u www-data -e\r\n\r\nLaravel\u4e2d\u4fee\u6539\u521b\u5efa\u65e5\u5fd7\u6587\u4ef6\u7684\u6743\u9650\uff1a\r\n\r\n\u7f16\u8f91 confog\/logging.php \u6587\u4ef6\r\n\u6dfb\u52a0 'permission' => 0664\r\n'daily' => [\r\n        'driver' => 'daily',\r\n        'path' => storage_path('logs\/laravel.log'),\r\n        'level' => 'debug',\r\n        'days' => 14,\r\n        'permission' => 0664,\r\n],\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"

          \u5728\u8bb2\u8fd9\u4e2a\u95ee\u9898\u4e4b\u524d\u53ef\u80fd\u9700\u8981\u7b80\u5355\u4ecb\u7ecd\u4e0bLinux\u7cfb\u7edf\u4e0b\u7684\u6587\u4ef6\u7684Ownership\u548cPermission\u3002 User […]<\/p>\n","protected":false},"author":63,"featured_media":157044,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-157041","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/157041","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/63"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=157041"}],"version-history":[{"count":10,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/157041\/revisions"}],"predecessor-version":[{"id":157584,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/157041\/revisions\/157584"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/157044"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=157041"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=157041"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=157041"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}