{"id":82518,"date":"2026-07-25T10:09:41","date_gmt":"2026-07-25T02:09:41","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/82518.html"},"modified":"2026-07-25T10:09:41","modified_gmt":"2026-07-25T02:09:41","slug":"linux%e7%ac%ac04%e7%af%87%ef%bc%9a%e7%94%a8%e6%88%b7%e4%b8%8e%e6%9d%83%e9%99%90%e7%ae%a1%e7%90%86-%e5%a4%9a%e4%ba%ba%e5%8d%8f%e4%bd%9c%e6%9c%8d%e5%8a%a1%e5%99%a8%e7%9a%84%e5%ae%89","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/82518.html","title":{"rendered":"Linux\u7b2c04\u7bc7\uff1a\u7528\u6237\u4e0e\u6743\u9650\u7ba1\u7406\u2014\u2014\u591a\u4eba\u534f\u4f5c\u670d\u52a1\u5668\u7684\u5b89\u5168\u57fa\u77f3"},"content":{"rendered":"<p>\u672c\u6587\u5bfc\u8bfb&#xff1a;\u672c\u6587\u662f\u7cfb\u5217\u7b2c 4 \u7bc7&#xff0c;\u805a\u7126 Linux \u6743\u9650\u4f53\u7cfb\u3002Java SaaS \u5e94\u7528\u5982\u679c\u7528 root \u6743\u9650\u8fd0\u884c&#xff0c;\u4e00\u65e6\u51fa\u73b0\u5b89\u5168\u6f0f\u6d1e&#xff0c;\u653b\u51fb\u8005\u5c31\u76f4\u63a5\u62ff\u5230\u4e86\u670d\u52a1\u5668\u6700\u9ad8\u6743\u9650\u3002\u672c\u6587\u4f1a\u8bb2\u900f\u7528\u6237\/\u7ec4\u7ba1\u7406\u3001chmod \u6743\u9650\u4f4d\u7684\u672c\u8d28\u3001sudo \u914d\u7f6e&#xff0c;\u5e76\u63d0\u4f9b Spring Boot \u5e94\u7528\u4e13\u7528\u4f4e\u6743\u9650\u7528\u6237\u7684\u6807\u51c6\u914d\u7f6e\u65b9\u6848\u3002<\/p>\n<h3>\u4e00\u3001\u4e3a\u4ec0\u4e48\u6743\u9650\u7ba1\u7406\u5bf9 Java SaaS \u90e8\u7f72\u81f3\u5173\u91cd\u8981<\/h3>\n<p>\u5f88\u591a\u56e2\u961f\u5728\u90e8\u7f72 Spring Boot \u5e94\u7528\u65f6\u56fe\u65b9\u4fbf&#xff0c;\u76f4\u63a5\u7528 root \u7528\u6237\u542f\u52a8\u670d\u52a1\u3001\u7528 777 \u6743\u9650\u89e3\u51b3&#034;\u6743\u9650\u4e0d\u591f&#034;\u7684\u62a5\u9519\u3002\u8fd9\u79cd\u505a\u6cd5\u5728\u6d4b\u8bd5\u73af\u5883\u51d1\u5408\u80fd\u7528&#xff0c;\u4f46\u5e26\u5230\u751f\u4ea7\u73af\u5883\u662f\u4e00\u4e2a\u5b9a\u65f6\u70b8\u5f39\u3002<\/p>\n<p>\u8bbe\u60f3\u8fd9\u6837\u4e00\u4e2a\u573a\u666f&#xff1a;\u4f60\u7684\u5e94\u7528\u6709\u4e00\u4e2a\u6587\u4ef6\u4e0a\u4f20\u63a5\u53e3&#xff0c;\u5b58\u5728\u8def\u5f84\u7a7f\u8d8a\u6f0f\u6d1e&#xff08;\u8fd9\u7c7b\u6f0f\u6d1e\u5728 Java \u751f\u6001\u91cc\u5e76\u4e0d\u7f55\u89c1&#xff0c;\u5e38\u89c1\u4e8e\u4f7f\u7528\u4e86\u4e0d\u5b89\u5168\u7684\u6587\u4ef6\u540d\u62fc\u63a5\u903b\u8f91&#xff09;\u3002\u5982\u679c\u5e94\u7528\u662f\u7528 root \u8eab\u4efd\u8fd0\u884c\u7684&#xff0c;\u653b\u51fb\u8005\u901a\u8fc7\u8fd9\u4e2a\u6f0f\u6d1e\u5199\u5165\u7684\u6587\u4ef6\u53ef\u4ee5\u8986\u76d6\u7cfb\u7edf\u4efb\u4f55\u4f4d\u7f6e&#xff0c;\u5305\u62ec \/etc\/passwd\u3001SSH \u7684 authorized_keys&#xff0c;\u76f8\u5f53\u4e8e\u76f4\u63a5\u62ff\u5230\u4e86\u670d\u52a1\u5668\u7684\u6700\u9ad8\u6743\u9650\u3002\u800c\u5982\u679c\u5e94\u7528\u8fd0\u884c\u5728\u4e00\u4e2a\u6743\u9650\u53d7\u9650\u7684\u4e13\u7528\u8d26\u6237\u4e0b&#xff0c;\u5373\u4f7f\u88ab\u653b\u7834&#xff0c;\u653b\u51fb\u8005\u80fd\u9020\u6210\u7684\u7834\u574f\u8303\u56f4\u4e5f\u88ab\u4e25\u683c\u9650\u5236\u5728\u8fd9\u4e2a\u8d26\u6237\u7684\u6743\u9650\u8fb9\u754c\u5185\u3002<\/p>\n<p>\u8fd9\u5c31\u662f Linux \u6743\u9650\u4f53\u7cfb\u5b58\u5728\u7684\u6838\u5fc3\u610f\u4e49&#xff1a;\u6700\u5c0f\u6743\u9650\u539f\u5219&#xff08;Principle of Least Privilege&#xff09;\u2014\u2014\u4efb\u4f55\u7a0b\u5e8f\u3001\u4efb\u4f55\u7528\u6237&#xff0c;\u53ea\u5e94\u8be5\u62e5\u6709\u5b8c\u6210\u5176\u5de5\u4f5c\u6240\u5fc5\u9700\u7684\u6700\u5c0f\u6743\u9650&#xff0c;\u4e0d\u591a\u7ed9\u4e00\u5206\u3002<\/p>\n<hr \/>\n<h3>\u4e8c\u3001\u7528\u6237\u4e0e\u7ec4&#xff1a;Linux \u591a\u7528\u6237\u4f53\u7cfb\u7684\u57fa\u7840<\/h3>\n<h4>2.1 \u7528\u6237\u7684\u672c\u8d28&#xff1a;\/etc\/passwd \u6587\u4ef6<\/h4>\n<p>Linux \u662f\u5929\u751f\u7684\u591a\u7528\u6237\u64cd\u4f5c\u7cfb\u7edf&#xff0c;\u6bcf\u4e2a\u7528\u6237\u90fd\u6709\u552f\u4e00\u7684 UID&#xff08;\u7528\u6237ID&#xff09;&#xff0c;\u7528\u6237\u4fe1\u606f\u5b58\u50a8\u5728 \/etc\/passwd \u6587\u4ef6\u91cc\u3002<\/p>\n<p><span class=\"token comment\"># \u67e5\u770b \/etc\/passwd \u6587\u4ef6\u7ed3\u6784<\/span><br \/>\n<span class=\"token function\">cat<\/span> \/etc\/passwd <span class=\"token operator\">|<\/span> <span class=\"token function\">head<\/span> <span class=\"token parameter variable\">-5<\/span><\/p>\n<p><span class=\"token comment\"># \u8f93\u51fa\u793a\u4f8b&#xff08;\u8282\u9009&#xff09;&#xff1a;<\/span><br \/>\n<span class=\"token comment\"># root:x:0:0:root:\/root:\/bin\/bash<\/span><br \/>\n<span class=\"token comment\"># www-data:x:33:33:www-data:\/var\/www:\/usr\/sbin\/nologin<\/span><br \/>\n<span class=\"token comment\"># myapp:x:1001:1001::\/opt\/myapp:\/sbin\/nologin<\/span><\/p>\n<p><span class=\"token comment\"># \u5b57\u6bb5\u8bf4\u660e&#xff08;\u7528\u5192\u53f7\u5206\u9694&#xff0c;\u51717\u4e2a\u5b57\u6bb5&#xff09;&#xff1a;<\/span><br \/>\n<span class=\"token comment\"># \u7528\u6237\u540d:\u5bc6\u7801\u5360\u4f4d\u7b26:UID:GID:\u7528\u6237\u5168\u540d(\u53ef\u9009):\u4e3b\u76ee\u5f55:\u767b\u5f55Shell<\/span><\/p>\n<p>\u6bcf\u4e2a\u5b57\u6bb5\u7684\u542b\u4e49\u9700\u8981\u91cd\u70b9\u7406\u89e3&#xff1a;<\/p>\n<table>\n<tr>\u5b57\u6bb5\u4f4d\u7f6e\u542b\u4e49\u793a\u4f8b<\/tr>\n<tbody>\n<tr>\n<td>1<\/td>\n<td>\u7528\u6237\u540d<\/td>\n<td>myapp<\/td>\n<\/tr>\n<tr>\n<td>2<\/td>\n<td>\u5bc6\u7801\u5360\u4f4d&#xff08;\u771f\u5b9e\u5bc6\u7801\u5728 \/etc\/shadow&#xff09;<\/td>\n<td>x<\/td>\n<\/tr>\n<tr>\n<td>3<\/td>\n<td>UID&#xff08;\u7528\u6237ID&#xff09;<\/td>\n<td>1001<\/td>\n<\/tr>\n<tr>\n<td>4<\/td>\n<td>GID&#xff08;\u4e3b\u7ec4ID&#xff09;<\/td>\n<td>1001<\/td>\n<\/tr>\n<tr>\n<td>5<\/td>\n<td>\u7528\u6237\u5168\u540d\/\u5907\u6ce8<\/td>\n<td>\u901a\u5e38\u7559\u7a7a<\/td>\n<\/tr>\n<tr>\n<td>6<\/td>\n<td>\u4e3b\u76ee\u5f55<\/td>\n<td>\/opt\/myapp<\/td>\n<\/tr>\n<tr>\n<td>7<\/td>\n<td>\u767b\u5f55 Shell<\/td>\n<td>\/sbin\/nologin&#xff08;\u8868\u793a\u7981\u6b62\u767b\u5f55&#xff09;<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&#x1f4a1; \u6838\u5fc3\u8ba4\u77e5&#xff1a;\u6ce8\u610f\u4e0a\u9762 myapp \u7528\u6237\u7684\u6700\u540e\u4e00\u4e2a\u5b57\u6bb5\u662f \/sbin\/nologin&#xff0c;\u8fd9\u8868\u793a\u8fd9\u4e2a\u8d26\u6237\u4e0d\u80fd\u7528\u6765 SSH \u767b\u5f55\u7cfb\u7edf&#xff0c;\u53ea\u80fd\u88ab\u7528\u6765&#034;\u8fd0\u884c\u8fdb\u7a0b&#034;&#xff08;\u6bd4\u5982\u542f\u52a8 Spring Boot \u5e94\u7528&#xff09;\u3002\u8fd9\u662f\u521b\u5efa\u5e94\u7528\u4e13\u7528\u8d26\u6237\u7684\u6807\u51c6\u505a\u6cd5\u2014\u2014\u53ea\u8d4b\u4e88\u8fd0\u884c\u7a0b\u5e8f\u7684\u80fd\u529b&#xff0c;\u4e0d\u8d4b\u4e88\u767b\u5f55\u7cfb\u7edf\u7684\u80fd\u529b&#xff0c;\u8fdb\u4e00\u6b65\u7f29\u5c0f\u653b\u51fb\u9762\u3002<\/p>\n<p>UID \u7684\u8303\u56f4\u4e5f\u6709\u8bb2\u7a76&#xff1a;<\/p>\n<p><span class=\"token comment\"># \u67e5\u770b\u5f53\u524d\u7cfb\u7edf\u7684 UID \u5206\u914d\u89c4\u5219<\/span><br \/>\n<span class=\"token function\">cat<\/span> \/etc\/login.defs <span class=\"token operator\">|<\/span> <span class=\"token function\">grep<\/span> <span class=\"token parameter variable\">-E<\/span> <span class=\"token string\">&#034;^UID_MIN|^UID_MAX&#034;<\/span><br \/>\n<span class=\"token comment\"># UID_MIN  1000   \u2190 \u666e\u901a\u7528\u6237\u7684\u6700\u5c0f UID<\/span><br \/>\n<span class=\"token comment\"># UID_MAX  60000  \u2190 \u666e\u901a\u7528\u6237\u7684\u6700\u5927 UID<\/span><\/p>\n<p><span class=\"token comment\"># UID 0 \u6c38\u8fdc\u662f root&#xff0c;UID 1-999 \u901a\u5e38\u662f\u7cfb\u7edf\u670d\u52a1\u8d26\u6237&#xff08;\u5982 www-data\u3001mysql&#xff09;<\/span><br \/>\n<span class=\"token comment\"># UID 1000&#043; \u624d\u662f\u771f\u6b63\u610f\u4e49\u4e0a\u7684&#034;\u666e\u901a\u7528\u6237&#034;<\/span><\/p>\n<h4>2.2 \u7528\u6237\u7ba1\u7406\u547d\u4ee4\u5b9e\u6218<\/h4>\n<p><span class=\"token comment\"># &#061;&#061;&#061;&#061;&#061; \u521b\u5efa\u7528\u6237 &#061;&#061;&#061;&#061;&#061;<\/span><\/p>\n<p><span class=\"token comment\"># \u521b\u5efa\u4e00\u4e2a\u666e\u901a\u7528\u6237&#xff08;\u4f1a\u81ea\u52a8\u521b\u5efa\u4e3b\u76ee\u5f55\u3001\u5206\u914d UID\/GID&#xff09;<\/span><br \/>\n<span class=\"token function\">sudo<\/span> <span class=\"token function\">useradd<\/span> <span class=\"token parameter variable\">-m<\/span> <span class=\"token parameter variable\">-s<\/span> \/bin\/bash devuser<br \/>\n<span class=\"token comment\"># -m&#xff1a;\u521b\u5efa\u4e3b\u76ee\u5f55&#xff08;\u4e0d\u52a0\u8fd9\u4e2a\u53c2\u6570&#xff0c;\u9ed8\u8ba4\u4e0d\u521b\u5efa\u4e3b\u76ee\u5f55&#xff09;<\/span><br \/>\n<span class=\"token comment\"># -s&#xff1a;\u6307\u5b9a\u767b\u5f55 Shell<\/span><\/p>\n<p><span class=\"token comment\"># \u521b\u5efa\u7cfb\u7edf\u670d\u52a1\u4e13\u7528\u8d26\u6237&#xff08;\u65e0\u767b\u5f55\u6743\u9650&#xff0c;\u5e38\u7528\u4e8e\u8fd0\u884c\u5e94\u7528&#xff09;<\/span><br \/>\n<span class=\"token function\">sudo<\/span> <span class=\"token function\">useradd<\/span> <span class=\"token parameter variable\">-r<\/span> <span class=\"token parameter variable\">-s<\/span> \/sbin\/nologin <span class=\"token parameter variable\">-d<\/span> \/opt\/myapp myapp<br \/>\n<span class=\"token comment\"># -r&#xff1a;\u521b\u5efa\u7cfb\u7edf\u8d26\u6237&#xff08;UID \u4f1a\u4ece\u7cfb\u7edf\u8d26\u6237\u8303\u56f4\u5206\u914d&#xff0c;\u800c\u4e0d\u662f\u666e\u901a\u7528\u6237\u8303\u56f4&#xff09;<\/span><br \/>\n<span class=\"token comment\"># -d&#xff1a;\u6307\u5b9a\u4e3b\u76ee\u5f55\u4f46\u4e0d\u521b\u5efa&#xff08;\u7cfb\u7edf\u8d26\u6237\u901a\u5e38\u5df2\u6709\u5e94\u7528\u90e8\u7f72\u76ee\u5f55\u5b58\u5728&#xff09;<\/span><\/p>\n<p><span class=\"token comment\"># &#061;&#061;&#061;&#061;&#061; \u8bbe\u7f6e\u5bc6\u7801 &#061;&#061;&#061;&#061;&#061;<\/span><br \/>\n<span class=\"token function\">sudo<\/span> <span class=\"token function\">passwd<\/span> devuser<br \/>\n<span class=\"token comment\"># \u4f1a\u63d0\u793a\u8f93\u5165\u4e24\u6b21\u65b0\u5bc6\u7801<\/span><\/p>\n<p><span class=\"token comment\"># &#061;&#061;&#061;&#061;&#061; \u67e5\u770b\u7528\u6237\u4fe1\u606f &#061;&#061;&#061;&#061;&#061;<\/span><br \/>\n<span class=\"token function\">id<\/span> devuser<br \/>\n<span class=\"token comment\"># \u8f93\u51fa\u793a\u4f8b&#xff1a;uid&#061;1002(devuser) gid&#061;1002(devuser) groups&#061;1002(devuser)<\/span><\/p>\n<p><span class=\"token comment\"># &#061;&#061;&#061;&#061;&#061; \u4fee\u6539\u7528\u6237\u5c5e\u6027 &#061;&#061;&#061;&#061;&#061;<\/span><br \/>\n<span class=\"token function\">sudo<\/span> <span class=\"token function\">usermod<\/span> <span class=\"token parameter variable\">-s<\/span> \/bin\/zsh devuser     <span class=\"token comment\"># \u4fee\u6539\u767b\u5f55 Shell<\/span><br \/>\n<span class=\"token function\">sudo<\/span> <span class=\"token function\">usermod<\/span> <span class=\"token parameter variable\">-aG<\/span> <span class=\"token function\">docker<\/span> devuser      <span class=\"token comment\"># \u628a\u7528\u6237\u52a0\u5165 docker \u7ec4&#xff08;-a \u662f\u8ffd\u52a0&#xff0c;\u4e0d\u52a0\u4f1a\u8986\u76d6\u539f\u6709\u6240\u6709\u7ec4&#xff01;&#xff09;<\/span><br \/>\n<span class=\"token function\">sudo<\/span> <span class=\"token function\">usermod<\/span> <span class=\"token parameter variable\">-L<\/span> devuser              <span class=\"token comment\"># \u9501\u5b9a\u8d26\u6237&#xff08;\u7981\u6b62\u767b\u5f55&#xff0c;\u4f46\u4e0d\u5220\u9664&#xff09;<\/span><br \/>\n<span class=\"token function\">sudo<\/span> <span class=\"token function\">usermod<\/span> <span class=\"token parameter variable\">-U<\/span> devuser              <span class=\"token comment\"># \u89e3\u9501\u8d26\u6237<\/span><\/p>\n<p><span class=\"token comment\"># &#061;&#061;&#061;&#061;&#061; \u5220\u9664\u7528\u6237 &#061;&#061;&#061;&#061;&#061;<\/span><br \/>\n<span class=\"token function\">sudo<\/span> <span class=\"token function\">userdel<\/span> devuser              <span class=\"token comment\"># \u53ea\u5220\u9664\u7528\u6237&#xff0c;\u4e3b\u76ee\u5f55\u4fdd\u7559<\/span><br \/>\n<span class=\"token function\">sudo<\/span> <span class=\"token function\">userdel<\/span> <span class=\"token parameter variable\">-r<\/span> devuser           <span class=\"token comment\"># \u5220\u9664\u7528\u6237\u5e76\u5220\u9664\u5176\u4e3b\u76ee\u5f55\u53ca\u90ae\u4ef6\u76ee\u5f55<\/span><\/p>\n<p>\u26a0\ufe0f \u8e29\u5751\u8bb0\u5f55&#xff1a;usermod -G \u548c usermod -aG \u662f\u5b8c\u5168\u4e0d\u540c\u7684\u64cd\u4f5c&#xff0c;\u8fd9\u662f\u65b0\u624b\u6700\u5bb9\u6613\u8e29\u7684\u5751\u4e4b\u4e00\u3002-G \u4f1a\u8986\u76d6\u7528\u6237\u5f53\u524d\u6240\u5c5e\u7684\u6240\u6709\u9644\u52a0\u7ec4&#xff0c;\u53ea\u4fdd\u7559\u4f60\u6307\u5b9a\u7684\u8fd9\u4e00\u4e2a&#xff1b;-aG&#xff08;append &#043; Group&#xff09;\u624d\u662f\u8ffd\u52a0\u5230\u73b0\u6709\u7ec4\u5217\u8868\u4e2d\u3002\u66fe\u7ecf\u53d1\u751f\u8fc7\u8fd9\u6837\u7684\u4e8b\u6545&#xff1a;\u7ba1\u7406\u5458\u60f3\u628a\u4e00\u4e2a\u7528\u6237\u52a0\u5165 docker \u7ec4&#xff0c;\u6267\u884c\u4e86 usermod -G docker username&#xff0c;\u7ed3\u679c\u8fd9\u4e2a\u7528\u6237\u539f\u672c\u6240\u5c5e\u7684 sudo \u7ec4\u3001\u5176\u4ed6\u4e1a\u52a1\u7ec4\u5168\u90e8\u88ab\u79fb\u9664&#xff0c;\u5bfc\u81f4\u4e00\u7cfb\u5217\u6743\u9650\u95ee\u9898\u6392\u67e5\u4e86\u5f88\u4e45\u624d\u53d1\u73b0\u6839\u56e0\u3002\u8bb0\u4f4f&#xff1a;\u6c38\u8fdc\u7528 -aG&#xff0c;\u51e0\u4e4e\u4e0d\u4f1a\u7528\u5230\u5355\u72ec\u7684 -G\u3002<\/p>\n<h4>2.3 \u7ec4\u7ba1\u7406&#xff1a;\u6743\u9650\u5206\u914d\u7684\u6279\u91cf\u5316\u5de5\u5177<\/h4>\n<p>\u7ec4&#xff08;Group&#xff09;\u7684\u5b58\u5728\u662f\u4e3a\u4e86\u6279\u91cf\u7ba1\u7406\u6743\u9650\u2014\u2014\u7ed9\u4e00\u4e2a\u7ec4\u8bbe\u7f6e\u6743\u9650&#xff0c;\u7ec4\u5185\u6240\u6709\u7528\u6237\u81ea\u52a8\u83b7\u5f97\u8fd9\u4e2a\u6743\u9650&#xff0c;\u4e0d\u9700\u8981\u9010\u4e2a\u7528\u6237\u5355\u72ec\u914d\u7f6e\u3002<\/p>\n<p><span class=\"token comment\"># \u521b\u5efa\u7ec4<\/span><br \/>\n<span class=\"token function\">sudo<\/span> <span class=\"token function\">groupadd<\/span> developers<\/p>\n<p><span class=\"token comment\"># \u521b\u5efa\u7ec4\u5e76\u6307\u5b9a GID<\/span><br \/>\n<span class=\"token function\">sudo<\/span> <span class=\"token function\">groupadd<\/span> <span class=\"token parameter variable\">-g<\/span> <span class=\"token number\">2000<\/span> developers<\/p>\n<p><span class=\"token comment\"># \u628a\u7528\u6237\u52a0\u5165\u7ec4&#xff08;\u7528\u6237\u53ef\u4ee5\u5c5e\u4e8e\u591a\u4e2a\u7ec4&#xff1a;1\u4e2a\u4e3b\u7ec4 &#043; \u591a\u4e2a\u9644\u52a0\u7ec4&#xff09;<\/span><br \/>\n<span class=\"token function\">sudo<\/span> <span class=\"token function\">usermod<\/span> <span class=\"token parameter variable\">-aG<\/span> developers devuser<\/p>\n<p><span class=\"token comment\"># \u67e5\u770b\u4e00\u4e2a\u7ec4\u91cc\u6709\u54ea\u4e9b\u7528\u6237<\/span><br \/>\ngetent group developers<br \/>\n<span class=\"token comment\"># \u8f93\u51fa\u793a\u4f8b&#xff1a;developers:x:2000:devuser,otheruser<\/span><\/p>\n<p><span class=\"token comment\"># \u67e5\u770b\u67d0\u4e2a\u7528\u6237\u5c5e\u4e8e\u54ea\u4e9b\u7ec4<\/span><br \/>\n<span class=\"token function\">groups<\/span> devuser<\/p>\n<p><span class=\"token comment\"># \u5220\u9664\u7ec4&#xff08;\u6ce8\u610f&#xff1a;\u7ec4\u5185\u8fd8\u6709\u7528\u6237\u65f6&#xff0c;\u90e8\u5206\u7cfb\u7edf\u4f1a\u62d2\u7edd\u5220\u9664&#xff0c;\u9700\u5148\u79fb\u9664\u6210\u5458&#xff09;<\/span><br \/>\n<span class=\"token function\">sudo<\/span> <span class=\"token function\">groupdel<\/span> developers<\/p>\n<p><span class=\"token comment\"># \u5b9e\u6218\u573a\u666f&#xff1a;\u8ba9\u591a\u4e2a\u5f00\u53d1\u8005\u5171\u4eab\u5bf9\u67d0\u4e2a\u9879\u76ee\u76ee\u5f55\u7684\u5199\u6743\u9650<\/span><br \/>\n<span class=\"token function\">sudo<\/span> <span class=\"token function\">groupadd<\/span> projectteam<br \/>\n<span class=\"token function\">sudo<\/span> <span class=\"token function\">usermod<\/span> <span class=\"token parameter variable\">-aG<\/span> projectteam alice<br \/>\n<span class=\"token function\">sudo<\/span> <span class=\"token function\">usermod<\/span> <span class=\"token parameter variable\">-aG<\/span> projectteam bob<br \/>\n<span class=\"token function\">sudo<\/span> <span class=\"token function\">chown<\/span> <span class=\"token parameter variable\">-R<\/span> :projectteam \/opt\/shared-project<br \/>\n<span class=\"token function\">sudo<\/span> <span class=\"token function\">chmod<\/span> <span class=\"token parameter variable\">-R<\/span> <span class=\"token number\">2775<\/span> \/opt\/shared-project   <span class=\"token comment\"># 2 \u662f setgid \u4f4d&#xff0c;\u4e0b\u9762\u4f1a\u8be6\u7ec6\u8bb2<\/span><\/p>\n<hr \/>\n<h3>\u4e09\u3001\u6743\u9650\u4f4d\u6df1\u5ea6\u89e3\u6790&#xff1a;chmod \u7684\u672c\u8d28<\/h3>\n<h4>3.1 \u4e09\u7c7b\u8eab\u4efd\u4e0e\u4e09\u79cd\u6743\u9650<\/h4>\n<p>Linux \u6587\u4ef6\u6743\u9650\u7684\u8bbe\u8ba1\u662f\u4e00\u4e2a 3\u00d73 \u7684\u77e9\u9635&#xff1a;\u4e09\u7c7b\u8eab\u4efd&#xff08;\u6240\u6709\u8005 Owner\u3001\u6240\u5c5e\u7ec4 Group\u3001\u5176\u4ed6\u4eba Others&#xff09;\u00d7 \u4e09\u79cd\u6743\u9650&#xff08;\u8bfb Read\u3001\u5199 Write\u3001\u6267\u884c Execute&#xff09;\u3002<\/p>\n<p><span class=\"token comment\"># \u7528 ls -l \u67e5\u770b\u6743\u9650\u793a\u4f8b<\/span><br \/>\n$ <span class=\"token function\">ls<\/span> <span class=\"token parameter variable\">-l<\/span> app.jar<br \/>\n-rwxr-xr&#8211; <span class=\"token number\">1<\/span> myapp myapp <span class=\"token number\">50000000<\/span> Jun <span class=\"token number\">20<\/span> <span class=\"token number\">10<\/span>:00 app.jar<br \/>\n \u2502\u2514\u252c\u2518\u2514\u252c\u2518\u2514\u252c\u2518<br \/>\n \u2502 \u2502  \u2502  \u2502<br \/>\n \u2502 \u2502  \u2502  \u2514\u2500 \u5176\u4ed6\u4eba<span class=\"token punctuation\">(<\/span>Others<span class=\"token punctuation\">)<\/span>\u6743\u9650&#xff1a;r&#8211; <span class=\"token punctuation\">(<\/span>\u53ea\u8bfb<span class=\"token punctuation\">)<\/span><br \/>\n \u2502 \u2502  \u2514\u2500\u2500\u2500\u2500 \u6240\u5c5e\u7ec4<span class=\"token punctuation\">(<\/span>Group<span class=\"token punctuation\">)<\/span>\u6743\u9650&#xff1a;r-x <span class=\"token punctuation\">(<\/span>\u8bfb&#043;\u6267\u884c<span class=\"token punctuation\">)<\/span><br \/>\n \u2502 \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500 \u6240\u6709\u8005<span class=\"token punctuation\">(<\/span>Owner<span class=\"token punctuation\">)<\/span>\u6743\u9650&#xff1a;rwx <span class=\"token punctuation\">(<\/span>\u8bfb&#043;\u5199&#043;\u6267\u884c<span class=\"token punctuation\">)<\/span><br \/>\n \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 \u6587\u4ef6\u7c7b\u578b&#xff1a;- \u8868\u793a\u666e\u901a\u6587\u4ef6<\/p>\n<p>\u6bcf\u4e00\u7ec4\u4e09\u4e2a\u5b57\u7b26\u5206\u522b\u4ee3\u8868\u8bfb&#xff08;r&#xff09;\u3001\u5199&#xff08;w&#xff09;\u3001\u6267\u884c&#xff08;x&#xff09;&#xff0c;\u7f3a\u5931\u67d0\u4e2a\u6743\u9650\u5c31\u7528 &#8211; \u5360\u4f4d\u3002<\/p>\n<table>\n<tr>\u6743\u9650\u7b26\u53f7\u6570\u5b57\u503c\u5bf9\u6587\u4ef6\u7684\u542b\u4e49\u5bf9\u76ee\u5f55\u7684\u542b\u4e49<\/tr>\n<tbody>\n<tr>\n<td>r&#xff08;\u8bfb&#xff09;<\/td>\n<td>4<\/td>\n<td>\u53ef\u4ee5\u67e5\u770b\u6587\u4ef6\u5185\u5bb9<\/td>\n<td>\u53ef\u4ee5\u5217\u51fa\u76ee\u5f55\u5185\u5bb9&#xff08;ls&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>w&#xff08;\u5199&#xff09;<\/td>\n<td>2<\/td>\n<td>\u53ef\u4ee5\u4fee\u6539\u6587\u4ef6\u5185\u5bb9<\/td>\n<td>\u53ef\u4ee5\u5728\u76ee\u5f55\u5185\u521b\u5efa\/\u5220\u9664\u6587\u4ef6<\/td>\n<\/tr>\n<tr>\n<td>x&#xff08;\u6267\u884c&#xff09;<\/td>\n<td>1<\/td>\n<td>\u53ef\u4ee5\u4f5c\u4e3a\u7a0b\u5e8f\u8fd0\u884c<\/td>\n<td>\u53ef\u4ee5\u8fdb\u5165\u8be5\u76ee\u5f55&#xff08;cd&#xff09;<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&#x1f4a1; \u6838\u5fc3\u8ba4\u77e5&#xff1a;\u5f88\u591a\u4eba\u4e0d\u77e5\u9053\u76ee\u5f55\u7684\u6743\u9650\u548c\u6587\u4ef6\u7684\u6743\u9650\u542b\u4e49\u4e0d\u5b8c\u5168\u76f8\u540c\u3002\u5bf9\u76ee\u5f55\u6765\u8bf4&#xff0c;\u201c\u6267\u884c&#034;\u6743\u9650&#xff08;x&#xff09;\u7684\u771f\u5b9e\u542b\u4e49\u662f&#034;\u80fd\u4e0d\u80fd\u8fdb\u5165\u8fd9\u4e2a\u76ee\u5f55\u201d&#xff0c;\u800c\u4e0d\u662f&#034;\u80fd\u4e0d\u80fd\u8fd0\u884c\u8fd9\u4e2a\u76ee\u5f55&#034;\u3002\u4e00\u4e2a\u76ee\u5f55\u54ea\u6015\u6709\u8bfb\u6743\u9650&#xff08;r&#xff09;\u80fd\u5217\u51fa\u6587\u4ef6\u540d&#xff0c;\u4f46\u5982\u679c\u6ca1\u6709\u6267\u884c\u6743\u9650&#xff08;x&#xff09;&#xff0c;\u662f\u65e0\u6cd5 cd \u8fdb\u53bb\u3001\u4e5f\u65e0\u6cd5\u8bbf\u95ee\u76ee\u5f55\u5185\u4efb\u4f55\u6587\u4ef6\u7684&#xff0c;\u5373\u4f7f\u4f60\u77e5\u9053\u6587\u4ef6\u540d\u4e5f\u4e0d\u884c\u3002\u8fd9\u662f\u65b0\u624b\u6700\u5bb9\u6613\u56f0\u60d1\u7684\u5730\u65b9\u3002<\/p>\n<h4>3.2 chmod \u7684\u4e24\u79cd\u5199\u6cd5&#xff1a;\u6570\u5b57\u6cd5\u4e0e\u7b26\u53f7\u6cd5<\/h4>\n<p><span class=\"token comment\"># &#061;&#061;&#061;&#061;&#061; \u6570\u5b57\u6cd5&#xff08;\u751f\u4ea7\u73af\u5883\u6700\u5e38\u7528&#xff0c;\u7b80\u6d01\u9ad8\u6548&#xff09;&#061;&#061;&#061;&#061;&#061;<\/span><\/p>\n<p><span class=\"token comment\"># \u628a 3 \u7ec4\u6743\u9650\u5206\u522b\u8f6c\u6210\u6570\u5b57\u76f8\u52a0&#xff1a;rwx&#061;4&#043;2&#043;1&#061;7&#xff0c;r-x&#061;4&#043;0&#043;1&#061;5&#xff0c;r&#8211;&#061;4&#043;0&#043;0&#061;4<\/span><br \/>\n<span class=\"token function\">chmod<\/span> <span class=\"token number\">754<\/span> app.jar<br \/>\n<span class=\"token comment\"># \u542b\u4e49&#xff1a;\u6240\u6709\u8005rwx(7)&#xff0c;\u6240\u5c5e\u7ec4r-x(5)&#xff0c;\u5176\u4ed6\u4ebar&#8211;(4)<\/span><\/p>\n<p><span class=\"token comment\"># \u5e38\u89c1\u6743\u9650\u7ec4\u5408\u901f\u67e5\u8868&#xff1a;<\/span><br \/>\n<span class=\"token function\">chmod<\/span> <span class=\"token number\">644<\/span> config.yml    <span class=\"token comment\"># rw-r&#8211;r&#8211;&#xff1a;\u6240\u6709\u8005\u53ef\u8bfb\u5199&#xff0c;\u5176\u4ed6\u4eba\u53ea\u8bfb&#xff08;\u666e\u901a\u914d\u7f6e\u6587\u4ef6\u5e38\u7528&#xff09;<\/span><br \/>\n<span class=\"token function\">chmod<\/span> <span class=\"token number\">600<\/span> id_ed25519    <span class=\"token comment\"># rw&#8212;&#8212;-&#xff1a;\u53ea\u6709\u6240\u6709\u8005\u53ef\u8bfb\u5199&#xff08;\u79c1\u94a5\u3001\u654f\u611f\u6587\u4ef6\u6807\u51c6\u6743\u9650&#xff09;<\/span><br \/>\n<span class=\"token function\">chmod<\/span> <span class=\"token number\">755<\/span> start.sh      <span class=\"token comment\"># rwxr-xr-x&#xff1a;\u6240\u6709\u8005\u53ef\u8bfb\u5199\u6267\u884c&#xff0c;\u5176\u4ed6\u4eba\u53ef\u8bfb\u53ef\u6267\u884c&#xff08;\u811a\u672c\u5e38\u7528&#xff09;<\/span><br \/>\n<span class=\"token function\">chmod<\/span> <span class=\"token number\">700<\/span> ~\/.ssh         <span class=\"token comment\"># rwx&#8212;&#8212;&#xff1a;\u53ea\u6709\u6240\u6709\u8005\u80fd\u8bbf\u95ee&#xff08;SSH\u76ee\u5f55\u5f3a\u5236\u8981\u6c42&#xff09;<\/span><br \/>\n<span class=\"token function\">chmod<\/span> <span class=\"token number\">750<\/span> \/opt\/myapp     <span class=\"token comment\"># rwxr-x&#8212;&#xff1a;\u6240\u6709\u8005\u5168\u6743\u9650&#xff0c;\u6240\u5c5e\u7ec4\u53ef\u8bfb\u53ef\u8fdb\u5165&#xff0c;\u5176\u4ed6\u4eba\u65e0\u6743\u9650<\/span><\/p>\n<p><span class=\"token comment\"># &#061;&#061;&#061;&#061;&#061; \u7b26\u53f7\u6cd5&#xff08;\u66f4\u76f4\u89c2\u4f46\u7a0d\u7e41\u7410&#xff0c;\u9002\u5408\u7cbe\u7ec6\u8c03\u6574&#xff09;&#061;&#061;&#061;&#061;&#061;<\/span><\/p>\n<p><span class=\"token function\">chmod<\/span> u&#043;x start.sh        <span class=\"token comment\"># \u7ed9\u6240\u6709\u8005(user)\u589e\u52a0\u6267\u884c\u6743\u9650<\/span><br \/>\n<span class=\"token function\">chmod<\/span> g-w config.yml      <span class=\"token comment\"># \u79fb\u9664\u6240\u5c5e\u7ec4(group)\u7684\u5199\u6743\u9650<\/span><br \/>\n<span class=\"token function\">chmod<\/span> o-rwx secret.key    <span class=\"token comment\"># \u79fb\u9664\u5176\u4ed6\u4eba(others)\u7684\u6240\u6709\u6743\u9650<\/span><br \/>\n<span class=\"token function\">chmod<\/span> a&#043;r public.html     <span class=\"token comment\"># \u7ed9\u6240\u6709\u4eba(all)\u589e\u52a0\u8bfb\u6743\u9650<\/span><br \/>\n<span class=\"token function\">chmod<\/span> <span class=\"token assign-left variable\">u<\/span><span class=\"token operator\">&#061;<\/span>rwx,g<span class=\"token operator\">&#061;<\/span>rx,o<span class=\"token operator\">&#061;<\/span> app.sh  <span class=\"token comment\"># \u4e00\u6b21\u6027\u7cbe\u786e\u8bbe\u7f6e\u4e09\u7c7b\u8eab\u4efd\u7684\u6743\u9650<\/span><\/p>\n<p><span class=\"token comment\"># &#061;&#061;&#061;&#061;&#061; \u9012\u5f52\u4fee\u6539&#xff08;\u5bf9\u6574\u4e2a\u76ee\u5f55\u6811\u751f\u6548&#xff09;&#061;&#061;&#061;&#061;&#061;<\/span><br \/>\n<span class=\"token function\">chmod<\/span> <span class=\"token parameter variable\">-R<\/span> <span class=\"token number\">755<\/span> \/opt\/myapp\/scripts\/<\/p>\n<p>\u26a0\ufe0f \u8e29\u5751\u8bb0\u5f55&#xff1a;\u5343\u4e07\u4e0d\u8981\u56e0\u4e3a&#034;\u7701\u4e8b&#034;\u7528 chmod 777 \u6765\u89e3\u51b3\u6743\u9650\u4e0d\u591f\u7684\u62a5\u9519\u3002777 \u610f\u5473\u7740\u4efb\u4f55\u4eba\u90fd\u80fd\u8bfb\u5199\u6267\u884c\u8fd9\u4e2a\u6587\u4ef6\/\u76ee\u5f55&#xff0c;\u5305\u62ec\u7cfb\u7edf\u4e0a\u7684\u6240\u6709\u5176\u4ed6\u7528\u6237\u548c\u6240\u6709\u80fd\u5229\u7528\u6f0f\u6d1e\u6267\u884c\u547d\u4ee4\u7684\u653b\u51fb\u8005\u3002\u66fe\u7ecf\u89c1\u8fc7\u771f\u5b9e\u6848\u4f8b&#xff1a;\u67d0\u56e2\u961f\u7684\u6587\u4ef6\u4e0a\u4f20\u76ee\u5f55\u88ab\u8bbe\u6210 777&#034;\u56fe\u65b9\u4fbf&#034;&#xff0c;\u7ed3\u679c\u653b\u51fb\u8005\u4e0a\u4f20\u4e86\u4e00\u4e2a\u6076\u610f\u811a\u672c\u6587\u4ef6&#xff0c;\u56e0\u4e3a\u76ee\u5f55\u6240\u6709\u4eba\u53ef\u6267\u884c&#xff0c;\u811a\u672c\u88ab\u670d\u52a1\u5668\u5176\u4ed6\u8fdb\u7a0b\u610f\u5916\u6267\u884c&#xff0c;\u9020\u6210\u4e86\u5b89\u5168\u4e8b\u6545\u3002\u9047\u5230\u6743\u9650\u4e0d\u591f\u7684\u62a5\u9519&#xff0c;\u7b2c\u4e00\u53cd\u5e94\u5e94\u8be5\u662f\u68c0\u67e5\u6240\u6709\u8005\u548c\u6240\u5c5e\u7ec4\u662f\u5426\u6b63\u786e&#xff0c;\u800c\u4e0d\u662f\u65e0\u8111\u653e\u5f00\u6240\u6709\u6743\u9650\u3002<\/p>\n<h4>3.3 \u7279\u6b8a\u6743\u9650\u4f4d&#xff1a;SUID\u3001SGID\u3001Sticky Bit<\/h4>\n<p>\u9664\u4e86\u57fa\u672c\u7684 rwx&#xff0c;Linux \u8fd8\u6709\u4e09\u4e2a\u7279\u6b8a\u6743\u9650\u4f4d&#xff0c;\u751f\u4ea7\u73af\u5883\u4e2d\u4e5f\u4f1a\u9047\u5230&#xff1a;<\/p>\n<p><span class=\"token comment\"># SUID&#xff08;Set User ID&#xff09;&#xff1a;\u6267\u884c\u8be5\u7a0b\u5e8f\u65f6&#xff0c;\u4e34\u65f6\u83b7\u5f97\u6587\u4ef6\u6240\u6709\u8005\u7684\u6743\u9650<\/span><br \/>\n<span class=\"token comment\"># \u7ecf\u5178\u4f8b\u5b50&#xff1a;passwd \u547d\u4ee4\u9700\u8981\u4fee\u6539 \/etc\/shadow&#xff08;\u53ea\u6709 root \u80fd\u5199&#xff09;&#xff0c;\u4f46\u666e\u901a\u7528\u6237\u4e5f\u80fd\u6267\u884c passwd<\/span><br \/>\n<span class=\"token function\">ls<\/span> <span class=\"token parameter variable\">-l<\/span> \/usr\/bin\/passwd<br \/>\n<span class=\"token comment\"># -rwsr-xr-x 1 root root &#8230; \/usr\/bin\/passwd<\/span><br \/>\n<span class=\"token comment\"># \u6ce8\u610f\u6240\u6709\u8005\u6743\u9650\u4f4d\u662f s \u4e0d\u662f x&#xff0c;\u8fd9\u5c31\u662f SUID \u6807\u8bb0<\/span><\/p>\n<p><span class=\"token comment\"># \u8bbe\u7f6e SUID&#xff08;\u6570\u5b57\u6cd5\u524d\u9762\u52a0 4&#xff09;<\/span><br \/>\n<span class=\"token function\">chmod<\/span> <span class=\"token number\">4755<\/span> \/opt\/myapp\/special-tool<\/p>\n<p><span class=\"token comment\"># SGID&#xff08;Set Group ID&#xff09;&#xff1a;\u5728\u76ee\u5f55\u4e0a\u8bbe\u7f6e&#xff0c;\u65b0\u521b\u5efa\u7684\u6587\u4ef6\u81ea\u52a8\u7ee7\u627f\u8be5\u76ee\u5f55\u7684\u6240\u5c5e\u7ec4<\/span><br \/>\n<span class=\"token comment\"># \u5e38\u7528\u4e8e\u56e2\u961f\u5171\u4eab\u76ee\u5f55&#xff0c;\u907f\u514d\u65b0\u6587\u4ef6\u7684\u7ec4\u5f52\u5c5e\u6df7\u4e71<\/span><br \/>\n<span class=\"token function\">chmod<\/span> <span class=\"token number\">2775<\/span> \/opt\/shared-project<br \/>\n<span class=\"token comment\"># \u7b2c\u4e00\u4f4d 2 \u5c31\u662f SGID \u6807\u8bb0&#xff0c;\u76ee\u5f55\u6743\u9650\u663e\u793a\u4e3a rwxrwsr-x&#xff08;\u6ce8\u610f\u7ec4\u6743\u9650\u4f4d\u7684 s&#xff09;<\/span><\/p>\n<p><span class=\"token comment\"># Sticky Bit&#xff1a;\u5728\u76ee\u5f55\u4e0a\u8bbe\u7f6e&#xff0c;\u8be5\u76ee\u5f55\u4e0b\u7684\u6587\u4ef6\u53ea\u80fd\u88ab\u6240\u6709\u8005\u81ea\u5df1\u5220\u9664&#xff08;\u5373\u4f7f\u5176\u4ed6\u4eba\u6709\u76ee\u5f55\u5199\u6743\u9650&#xff09;<\/span><br \/>\n<span class=\"token comment\"># \u7ecf\u5178\u4f8b\u5b50&#xff1a;\/tmp \u76ee\u5f55&#xff0c;\u6240\u6709\u7528\u6237\u90fd\u80fd\u5728\u91cc\u9762\u521b\u5efa\u6587\u4ef6&#xff0c;\u4f46\u4e0d\u80fd\u5220\u9664\u522b\u4eba\u7684\u6587\u4ef6<\/span><br \/>\n<span class=\"token function\">ls<\/span> <span class=\"token parameter variable\">-ld<\/span> \/tmp<br \/>\n<span class=\"token comment\"># drwxrwxrwt &#8230; \/tmp<\/span><br \/>\n<span class=\"token comment\"># \u6ce8\u610f\u6700\u540e\u4e00\u4f4d\u662f t \u800c\u4e0d\u662f x&#xff0c;\u8fd9\u5c31\u662f Sticky Bit<\/span><br \/>\n<span class=\"token function\">chmod<\/span> <span class=\"token number\">1777<\/span> \/opt\/myapp\/shared-temp<\/p>\n<p>&#x1f4a1; \u751f\u4ea7\u63d0\u793a&#xff1a;SGID \u5728\u56e2\u961f\u534f\u4f5c\u76ee\u5f55\u4e2d\u975e\u5e38\u5b9e\u7528\u3002\u5982\u679c\u4e00\u4e2a\u76ee\u5f55\u8bbe\u7f6e\u4e86 SGID&#xff0c;\u65b0\u521b\u5efa\u5728\u8fd9\u4e2a\u76ee\u5f55\u4e0b\u7684\u6587\u4ef6\u4f1a\u81ea\u52a8\u7ee7\u627f\u76ee\u5f55\u7684\u6240\u5c5e\u7ec4&#xff08;\u800c\u4e0d\u662f\u521b\u5efa\u8005\u7684\u4e3b\u7ec4&#xff09;&#xff0c;\u8fd9\u6837\u56e2\u961f\u6210\u5458\u4e4b\u95f4\u521b\u5efa\u7684\u6587\u4ef6\u5929\u7136\u5c31\u662f\u540c\u4e00\u4e2a\u7ec4&#xff0c;\u4e0d\u9700\u8981\u6bcf\u6b21\u624b\u52a8 chgrp\u3002\u5bf9 \/opt\/shared-project \u8fd9\u7c7b\u591a\u4eba\u534f\u4f5c\u76ee\u5f55\u5f3a\u70c8\u5efa\u8bae\u8bbe\u7f6e SGID\u3002<\/p>\n<hr \/>\n<h3>\u56db\u3001\u6240\u6709\u6743\u7ba1\u7406&#xff1a;chown \/ chgrp<\/h3>\n<p><span class=\"token comment\"># chown&#xff1a;\u4fee\u6539\u6587\u4ef6\u7684\u6240\u6709\u8005\u548c\u6240\u5c5e\u7ec4<\/span><br \/>\n<span class=\"token function\">sudo<\/span> <span class=\"token function\">chown<\/span> myapp app.jar              <span class=\"token comment\"># \u53ea\u6539\u6240\u6709\u8005<\/span><br \/>\n<span class=\"token function\">sudo<\/span> <span class=\"token function\">chown<\/span> myapp:myapp app.jar        <span class=\"token comment\"># \u540c\u65f6\u6539\u6240\u6709\u8005\u548c\u6240\u5c5e\u7ec4<\/span><br \/>\n<span class=\"token function\">sudo<\/span> <span class=\"token function\">chown<\/span> :myapp app.jar             <span class=\"token comment\"># \u53ea\u6539\u6240\u5c5e\u7ec4&#xff08;\u7b49\u540c\u4e8e chgrp&#xff09;<\/span><\/p>\n<p><span class=\"token comment\"># \u9012\u5f52\u4fee\u6539\u6574\u4e2a\u76ee\u5f55&#xff08;\u90e8\u7f72\u5b8c\u6574\u5e94\u7528\u76ee\u5f55\u540e\u7684\u6807\u51c6\u64cd\u4f5c&#xff09;<\/span><br \/>\n<span class=\"token function\">sudo<\/span> <span class=\"token function\">chown<\/span> <span class=\"token parameter variable\">-R<\/span> myapp:myapp \/opt\/myapp\/<\/p>\n<p><span class=\"token comment\"># chgrp&#xff1a;\u5355\u72ec\u4fee\u6539\u6240\u5c5e\u7ec4&#xff08;\u529f\u80fd\u4e0a\u7b49\u540c\u4e8e chown :\u7ec4\u540d&#xff09;<\/span><br \/>\n<span class=\"token function\">sudo<\/span> <span class=\"token function\">chgrp<\/span> developers shared-file.txt<\/p>\n<p><span class=\"token comment\"># \u4fdd\u7559\u6240\u6709\u8005&#xff0c;\u53ea\u6539\u6240\u5c5e\u7ec4\u7684\u6279\u91cf\u64cd\u4f5c<\/span><br \/>\n<span class=\"token function\">sudo<\/span> <span class=\"token function\">chgrp<\/span> <span class=\"token parameter variable\">-R<\/span> developers \/opt\/shared-project\/<\/p>\n<p>\u26a0\ufe0f \u8e29\u5751\u8bb0\u5f55&#xff1a;\u6267\u884c chown -R \u9012\u5f52\u4fee\u6539\u5927\u578b\u76ee\u5f55&#xff08;\u6bd4\u5982\u5305\u542b\u51e0\u5341\u4e07\u4e2a\u6587\u4ef6\u7684 node_modules \u6216\u65e5\u5fd7\u76ee\u5f55&#xff09;\u65f6&#xff0c;\u8981\u6ce8\u610f\u8fd9\u4e2a\u64cd\u4f5c\u4e0d\u662f\u77ac\u95f4\u5b8c\u6210\u7684&#xff0c;\u4f1a\u9010\u4e2a\u6587\u4ef6\u4fee\u6539\u5143\u6570\u636e&#xff0c;\u76ee\u5f55\u6587\u4ef6\u6570\u91cf\u5de8\u5927\u65f6\u53ef\u80fd\u8017\u65f6\u51e0\u5206\u949f\u751a\u81f3\u66f4\u4e45\u3002\u5728\u751f\u4ea7\u73af\u5883\u5bf9\u5927\u76ee\u5f55\u6267\u884c\u8fd9\u7c7b\u64cd\u4f5c\u524d&#xff0c;\u6700\u597d\u5148\u7528 find \/opt\/myapp -type f | wc -l \u770b\u770b\u6587\u4ef6\u603b\u6570&#xff0c;\u8bc4\u4f30\u597d\u9884\u671f\u8017\u65f6&#xff0c;\u907f\u514d\u8bef\u4ee5\u4e3a\u547d\u4ee4&#034;\u5361\u4f4f\u4e86&#034;\u800c\u4e2d\u9014\u5f3a\u884c\u4e2d\u65ad\u3002<\/p>\n<hr \/>\n<h3>\u4e94\u3001umask&#xff1a;\u65b0\u5efa\u6587\u4ef6\u7684\u9ed8\u8ba4\u6743\u9650\u662f\u600e\u4e48\u51b3\u5b9a\u7684<\/h3>\n<p>\u4f60\u6709\u6ca1\u6709\u60f3\u8fc7&#xff0c;\u4e3a\u4ec0\u4e48\u7528 touch \u65b0\u5efa\u4e00\u4e2a\u6587\u4ef6&#xff0c;\u9ed8\u8ba4\u6743\u9650\u603b\u662f 644&#xff0c;\u800c\u7528 mkdir \u65b0\u5efa\u4e00\u4e2a\u76ee\u5f55\u9ed8\u8ba4\u662f 755&#xff1f;\u7b54\u6848\u662f umask\u3002<\/p>\n<p><span class=\"token comment\"># \u67e5\u770b\u5f53\u524d umask \u503c<\/span><br \/>\n<span class=\"token builtin class-name\">umask<\/span><br \/>\n<span class=\"token comment\"># \u8f93\u51fa\u793a\u4f8b&#xff1a;0022<\/span><\/p>\n<p><span class=\"token comment\"># umask \u7684\u8ba1\u7b97\u903b\u8f91&#xff1a;\u7528&#034;\u5b8c\u5168\u6743\u9650&#034;\u51cf\u53bb umask \u503c&#xff0c;\u5f97\u5230\u9ed8\u8ba4\u6743\u9650<\/span><br \/>\n<span class=\"token comment\"># \u6587\u4ef6\u7684\u5b8c\u5168\u6743\u9650\u57fa\u51c6\u662f 666&#xff08;rw-rw-rw-&#xff0c;\u6587\u4ef6\u9ed8\u8ba4\u4e0d\u5e26\u6267\u884c\u4f4d&#xff09;<\/span><br \/>\n<span class=\"token comment\"># \u76ee\u5f55\u7684\u5b8c\u5168\u6743\u9650\u57fa\u51c6\u662f 777&#xff08;rwxrwxrwx&#xff09;<\/span><\/p>\n<p><span class=\"token comment\"># 666 &#8211; 022 &#061; 644  \u2192 \u8fd9\u5c31\u662f\u4e3a\u4ec0\u4e48\u65b0\u5efa\u6587\u4ef6\u9ed8\u8ba4\u662f 644 (rw-r&#8211;r&#8211;)<\/span><br \/>\n<span class=\"token comment\"># 777 &#8211; 022 &#061; 755  \u2192 \u8fd9\u5c31\u662f\u4e3a\u4ec0\u4e48\u65b0\u5efa\u76ee\u5f55\u9ed8\u8ba4\u662f 755 (rwxr-xr-x)<\/span><\/p>\n<p><span class=\"token comment\"># \u4e34\u65f6\u4fee\u6539\u5f53\u524d Shell \u4f1a\u8bdd\u7684 umask<\/span><br \/>\n<span class=\"token builtin class-name\">umask<\/span> 027<br \/>\n<span class=\"token comment\"># 027 \u7684\u6548\u679c&#xff1a;\u65b0\u6587\u4ef6640(rw-r&#8212;&#8211;)&#xff0c;\u65b0\u76ee\u5f55750(rwxr-x&#8212;)&#xff0c;\u6bd4\u9ed8\u8ba4\u66f4\u4e25\u683c<\/span><\/p>\n<p><span class=\"token comment\"># \u6c38\u4e45\u4fee\u6539&#xff08;\u5199\u5165\u7528\u6237\u7684 shell \u914d\u7f6e\u6587\u4ef6&#xff09;<\/span><br \/>\n<span class=\"token builtin class-name\">echo<\/span> <span class=\"token string\">&#034;umask 027&#034;<\/span> <span class=\"token operator\">&gt;&gt;<\/span> ~\/.bashrc<\/p>\n<p>&#x1f4a1; \u751f\u4ea7\u63d0\u793a&#xff1a;\u5728\u521b\u5efa\u5e94\u7528\u4e13\u7528\u7528\u6237\u540e&#xff0c;\u7ed9\u8fd9\u4e2a\u7528\u6237\u8bbe\u7f6e\u66f4\u4e25\u683c\u7684 umask&#xff08;\u6bd4\u5982 027&#xff09;\u662f\u4e00\u79cd\u7eb5\u6df1\u9632\u5fa1\u7b56\u7565\u2014\u2014\u5373\u4f7f\u5e94\u7528\u4ee3\u7801\u91cc\u67d0\u5904\u5fd8\u8bb0\u663e\u5f0f\u8bbe\u7f6e\u6587\u4ef6\u6743\u9650&#xff0c;\u65b0\u521b\u5efa\u7684\u6587\u4ef6\u4e5f\u4e0d\u4f1a\u9ed8\u8ba4\u5bf9\u5176\u4ed6\u4eba\u5f00\u653e\u8bfb\u6743\u9650\u3002\u8fd9\u5bf9\u5b58\u653e\u654f\u611f\u6570\u636e&#xff08;\u914d\u7f6e\u6587\u4ef6\u542b\u6570\u636e\u5e93\u5bc6\u7801\u3001API\u5bc6\u94a5\u7b49&#xff09;\u7684\u5e94\u7528\u5c24\u5176\u91cd\u8981\u3002<\/p>\n<hr \/>\n<h3>\u516d\u3001sudo \u914d\u7f6e&#xff1a;\u7cbe\u7ec6\u5316\u6388\u6743\u800c\u975e\u5168\u6743 root<\/h3>\n<p>\u76f4\u63a5\u628a\u5f00\u53d1\u8005\u52a0\u5165\u9700\u8981 root \u6743\u9650\u7684\u573a\u666f&#xff0c;\u6700\u7b80\u5355\u7c97\u66b4\u7684\u65b9\u5f0f\u662f\u628a\u4ed6\u4eec\u52a0\u8fdb sudo \u7ec4&#xff0c;\u4f46\u751f\u4ea7\u73af\u5883\u66f4\u5b89\u5168\u7684\u505a\u6cd5\u662f\u7cbe\u7ec6\u5316\u914d\u7f6e\u2014\u2014\u53ea\u5141\u8bb8\u7279\u5b9a\u7528\u6237\u6267\u884c\u7279\u5b9a\u547d\u4ee4\u3002<\/p>\n<p><span class=\"token comment\"># \u628a\u7528\u6237\u52a0\u5165 sudo \u7ec4&#xff08;Ubuntu\/Debian \u662f sudo \u7ec4&#xff0c;CentOS\/Rocky \u662f wheel \u7ec4&#xff09;<\/span><br \/>\n<span class=\"token function\">sudo<\/span> <span class=\"token function\">usermod<\/span> <span class=\"token parameter variable\">-aG<\/span> <span class=\"token function\">sudo<\/span> devuser<\/p>\n<p><span class=\"token comment\"># \u7f16\u8f91 sudo \u6743\u9650\u914d\u7f6e&#xff08;\u6c38\u8fdc\u7528 visudo \u800c\u4e0d\u662f\u76f4\u63a5\u7f16\u8f91\u6587\u4ef6&#xff01;&#xff09;<\/span><br \/>\n<span class=\"token function\">sudo<\/span> visudo<\/p>\n<p><span class=\"token comment\"># \u5728 \/etc\/sudoers \u6216 \/etc\/sudoers.d\/ \u4e0b\u6dfb\u52a0\u81ea\u5b9a\u4e49\u89c4\u5219\u793a\u4f8b&#xff1a;<\/span><br \/>\n<span class=\"token comment\"># devuser ALL&#061;(ALL) NOPASSWD: \/usr\/bin\/systemctl restart myapp<\/span><br \/>\n<span class=\"token comment\"># \u542b\u4e49&#xff1a;devuser \u53ef\u4ee5\u65e0\u5bc6\u7801\u6267\u884c\u91cd\u542f myapp \u670d\u52a1\u8fd9\u4e00\u6761\u547d\u4ee4&#xff0c;\u4f46\u4e0d\u80fd\u6267\u884c\u5176\u4ed6\u4efb\u4f55 root \u64cd\u4f5c<\/span><\/p>\n<p><span class=\"token comment\"># \u63a8\u8350\u505a\u6cd5&#xff1a;\u5728 \/etc\/sudoers.d\/ \u4e0b\u521b\u5efa\u72ec\u7acb\u6587\u4ef6\u7ba1\u7406&#xff0c;\u800c\u4e0d\u662f\u76f4\u63a5\u6539\u4e3b\u6587\u4ef6<\/span><br \/>\n<span class=\"token function\">sudo<\/span> <span class=\"token function\">tee<\/span> \/etc\/sudoers.d\/myapp-deploy <span class=\"token operator\">&lt;&lt;<\/span><span class=\"token string\">&#039;EOF&#039;<br \/>\n# \u5141\u8bb8 deploy \u7528\u6237\u91cd\u542f\u548c\u67e5\u770b myapp \u670d\u52a1\u72b6\u6001&#xff0c;\u4e0d\u9700\u8981\u5bc6\u7801&#xff08;\u7528\u4e8e CI\/CD \u81ea\u52a8\u5316\u90e8\u7f72&#xff09;<br \/>\ndeploy ALL&#061;(ALL) NOPASSWD: \/usr\/bin\/systemctl restart myapp<br \/>\ndeploy ALL&#061;(ALL) NOPASSWD: \/usr\/bin\/systemctl status myapp<br \/>\nEOF<\/span><\/p>\n<p><span class=\"token comment\"># \u8bbe\u7f6e\u6b63\u786e\u6743\u9650&#xff08;sudoers.d \u4e0b\u7684\u6587\u4ef6\u5fc5\u987b\u662f 440&#xff0c;\u5426\u5219 sudo \u4f1a\u62d2\u7edd\u8bfb\u53d6&#xff09;<\/span><br \/>\n<span class=\"token function\">sudo<\/span> <span class=\"token function\">chmod<\/span> <span class=\"token number\">440<\/span> \/etc\/sudoers.d\/myapp-deploy<\/p>\n<p><span class=\"token comment\"># \u9a8c\u8bc1\u914d\u7f6e\u8bed\u6cd5\u662f\u5426\u6b63\u786e&#xff08;\u4fee\u6539\u540e\u52a1\u5fc5\u9a8c\u8bc1&#xff0c;\u907f\u514d\u628a\u81ea\u5df1\u9501\u6b7b\u5728\u5916\u9762&#xff09;<\/span><br \/>\n<span class=\"token function\">sudo<\/span> visudo <span class=\"token parameter variable\">-c<\/span><\/p>\n<p>\u26a0\ufe0f \u8e29\u5751\u8bb0\u5f55&#xff08;\u6781\u5176\u91cd\u8981&#xff09;&#xff1a;\u6c38\u8fdc\u4e0d\u8981\u7528 vim\/nano \u76f4\u63a5\u7f16\u8f91 \/etc\/sudoers \u6587\u4ef6&#xff0c;\u4e00\u5b9a\u8981\u7528 visudo \u547d\u4ee4\u3002\u539f\u56e0\u662f visudo \u5728\u4fdd\u5b58\u524d\u4f1a\u81ea\u52a8\u68c0\u67e5\u8bed\u6cd5&#xff0c;\u5982\u679c\u6709\u8bed\u6cd5\u9519\u8bef\u4f1a\u62d2\u7edd\u4fdd\u5b58\u5e76\u63d0\u793a\u4f60\u4fee\u6b63&#xff1b;\u800c\u76f4\u63a5\u7f16\u8f91\u6587\u4ef6\u4fdd\u5b58&#xff0c;\u4e07\u4e00\u8bed\u6cd5\u5199\u9519\u4e86&#xff0c;\u4f1a\u5bfc\u81f4\u7cfb\u7edf\u4e0a\u6240\u6709 sudo \u547d\u4ee4\u5168\u90e8\u5931\u6548&#xff0c;\u5305\u62ec\u4f60\u81ea\u5df1\u60f3\u7528 sudo \u6765\u4fee\u590d\u8fd9\u4e2a\u9519\u8bef\u7684\u5c1d\u8bd5\u2014\u2014\u8fd9\u662f\u771f\u6b63\u610f\u4e49\u4e0a\u628a\u81ea\u5df1\u9501\u5728\u95e8\u5916&#xff0c;\u552f\u4e00\u7684\u8865\u6551\u65b9\u5f0f\u901a\u5e38\u662f\u901a\u8fc7\u4e91\u670d\u52a1\u5668\u63a7\u5236\u53f0\u7684&#034;\u6551\u63f4\u6a21\u5f0f&#034;\u6216\u7269\u7406\u8bbf\u95ee\u673a\u5668\u624d\u80fd\u6062\u590d\u3002\u8fd9\u662f Linux \u8fd0\u7ef4\u4e2d\u540e\u679c\u6700\u4e25\u91cd\u7684\u9519\u8bef\u4e4b\u4e00&#xff0c;\u8bf7\u52a1\u5fc5\u7262\u8bb0\u7528 visudo\u3002<\/p>\n<hr \/>\n<h3>\u4e03\u3001Java SaaS \u5e94\u7528\u6700\u5c0f\u6743\u9650\u914d\u7f6e\u5b9e\u6218<\/h3>\n<p>\u628a\u672c\u7bc7\u6240\u6709\u77e5\u8bc6\u70b9\u6574\u5408&#xff0c;\u7ed9\u51fa\u4e00\u5957\u751f\u4ea7\u7ea7\u7684 Spring Boot \u5e94\u7528\u6743\u9650\u914d\u7f6e\u65b9\u6848&#xff1a;<\/p>\n<p><span class=\"token shebang important\">#!\/bin\/bash<\/span><br \/>\n<span class=\"token comment\"># \u6587\u4ef6\u540d&#xff1a;setup-app-user.sh<\/span><br \/>\n<span class=\"token comment\"># \u7528\u9014&#xff1a;\u4e3a Spring Boot \u5e94\u7528\u521b\u5efa\u7b26\u5408\u6700\u5c0f\u6743\u9650\u539f\u5219\u7684\u8fd0\u884c\u73af\u5883<\/span><\/p>\n<p><span class=\"token assign-left variable\">APP_NAME<\/span><span class=\"token operator\">&#061;<\/span><span class=\"token string\">&#034;myapp&#034;<\/span><br \/>\n<span class=\"token assign-left variable\">APP_DIR<\/span><span class=\"token operator\">&#061;<\/span><span class=\"token string\">&#034;\/opt\/<span class=\"token variable\">${APP_NAME}<\/span>&#034;<\/span><\/p>\n<p><span class=\"token comment\"># 1. \u521b\u5efa\u7cfb\u7edf\u4e13\u7528\u8d26\u6237&#xff0c;\u65e0\u767b\u5f55\u6743\u9650<\/span><br \/>\n<span class=\"token function\">sudo<\/span> <span class=\"token function\">useradd<\/span> <span class=\"token parameter variable\">-r<\/span> <span class=\"token parameter variable\">-s<\/span> \/sbin\/nologin <span class=\"token parameter variable\">-d<\/span> <span class=\"token string\">&#034;<span class=\"token variable\">${APP_DIR}<\/span>&#034;<\/span> <span class=\"token string\">&#034;<span class=\"token variable\">${APP_NAME}<\/span>&#034;<\/span><\/p>\n<p><span class=\"token comment\"># 2. \u521b\u5efa\u5e94\u7528\u76ee\u5f55\u7ed3\u6784<\/span><br \/>\n<span class=\"token function\">sudo<\/span> <span class=\"token function\">mkdir<\/span> <span class=\"token parameter variable\">-p<\/span> <span class=\"token string\">&#034;<span class=\"token variable\">${APP_DIR}<\/span>&#034;<\/span>\/<span class=\"token punctuation\">{<\/span>current,releases,config,logs,temp<span class=\"token punctuation\">}<\/span><br \/>\n<span class=\"token function\">sudo<\/span> <span class=\"token function\">mkdir<\/span> <span class=\"token parameter variable\">-p<\/span> <span class=\"token string\">&#034;\/var\/log\/<span class=\"token variable\">${APP_NAME}<\/span>&#034;<\/span><\/p>\n<p><span class=\"token comment\"># 3. \u8bbe\u7f6e\u6240\u6709\u6743&#xff1a;\u5e94\u7528\u76ee\u5f55\u5f52\u4e13\u7528\u7528\u6237\u6240\u6709<\/span><br \/>\n<span class=\"token function\">sudo<\/span> <span class=\"token function\">chown<\/span> <span class=\"token parameter variable\">-R<\/span> <span class=\"token string\">&#034;<span class=\"token variable\">${APP_NAME}<\/span>:<span class=\"token variable\">${APP_NAME}<\/span>&#034;<\/span> <span class=\"token string\">&#034;<span class=\"token variable\">${APP_DIR}<\/span>&#034;<\/span><br \/>\n<span class=\"token function\">sudo<\/span> <span class=\"token function\">chown<\/span> <span class=\"token parameter variable\">-R<\/span> <span class=\"token string\">&#034;<span class=\"token variable\">${APP_NAME}<\/span>:<span class=\"token variable\">${APP_NAME}<\/span>&#034;<\/span> <span class=\"token string\">&#034;\/var\/log\/<span class=\"token variable\">${APP_NAME}<\/span>&#034;<\/span><\/p>\n<p><span class=\"token comment\"># 4. \u7cbe\u7ec6\u5316\u8bbe\u7f6e\u6743\u9650&#xff1a;\u914d\u7f6e\u6587\u4ef6\u542b\u654f\u611f\u4fe1\u606f&#xff0c;\u9650\u5236\u8bfb\u53d6\u8303\u56f4<\/span><br \/>\n<span class=\"token function\">sudo<\/span> <span class=\"token function\">chmod<\/span> <span class=\"token number\">750<\/span> <span class=\"token string\">&#034;<span class=\"token variable\">${APP_DIR}<\/span>&#034;<\/span>                      <span class=\"token comment\"># \u5e94\u7528\u6839\u76ee\u5f55&#xff1a;\u4ec5\u6240\u6709\u8005\u548c\u7ec4\u53ef\u8fdb\u5165<\/span><br \/>\n<span class=\"token function\">sudo<\/span> <span class=\"token function\">chmod<\/span> <span class=\"token parameter variable\">-R<\/span> <span class=\"token number\">640<\/span> <span class=\"token string\">&#034;<span class=\"token variable\">${APP_DIR}<\/span>\/config\/&#034;<\/span>*.yml      <span class=\"token comment\"># \u914d\u7f6e\u6587\u4ef6&#xff1a;\u4ec5\u6240\u6709\u8005\u8bfb\u5199&#xff0c;\u7ec4\u53ea\u8bfb<\/span><br \/>\n<span class=\"token function\">sudo<\/span> <span class=\"token function\">chmod<\/span> <span class=\"token number\">755<\/span> <span class=\"token string\">&#034;<span class=\"token variable\">${APP_DIR}<\/span>\/current&#034;<\/span>              <span class=\"token comment\"># JAR \u5305\u76ee\u5f55&#xff1a;\u5141\u8bb8\u6267\u884c<\/span><br \/>\n<span class=\"token function\">sudo<\/span> <span class=\"token function\">chmod<\/span> <span class=\"token number\">750<\/span> <span class=\"token string\">&#034;<span class=\"token variable\">${APP_DIR}<\/span>\/logs&#034;<\/span>                 <span class=\"token comment\"># \u65e5\u5fd7\u76ee\u5f55&#xff1a;\u9650\u5236\u8bbf\u95ee<\/span><\/p>\n<p><span class=\"token comment\"># 5. \u914d\u7f6e sudo&#xff1a;\u5141\u8bb8\u8fd0\u7ef4\u4eba\u5458\u91cd\u542f\u670d\u52a1&#xff0c;\u4f46\u4e0d\u5f00\u653e\u5b8c\u6574 root \u6743\u9650<\/span><br \/>\n<span class=\"token function\">sudo<\/span> <span class=\"token function\">tee<\/span> <span class=\"token string\">&#034;\/etc\/sudoers.d\/<span class=\"token variable\">${APP_NAME}<\/span>-ops&#034;<\/span> <span class=\"token operator\">&lt;&lt;<\/span><span class=\"token string\">EOF<br \/>\n%<span class=\"token variable\">${APP_NAME}<\/span>ops ALL&#061;(ALL) NOPASSWD: \/usr\/bin\/systemctl restart <span class=\"token variable\">${APP_NAME}<\/span><br \/>\n%<span class=\"token variable\">${APP_NAME}<\/span>ops ALL&#061;(ALL) NOPASSWD: \/usr\/bin\/systemctl status <span class=\"token variable\">${APP_NAME}<\/span><br \/>\n%<span class=\"token variable\">${APP_NAME}<\/span>ops ALL&#061;(ALL) NOPASSWD: \/usr\/bin\/journalctl -u <span class=\"token variable\">${APP_NAME}<\/span><br \/>\nEOF<\/span><br \/>\n<span class=\"token function\">sudo<\/span> <span class=\"token function\">chmod<\/span> <span class=\"token number\">440<\/span> <span class=\"token string\">&#034;\/etc\/sudoers.d\/<span class=\"token variable\">${APP_NAME}<\/span>-ops&#034;<\/span><\/p>\n<p><span class=\"token builtin class-name\">echo<\/span> <span class=\"token string\">&#034;\u5e94\u7528\u7528\u6237\u548c\u6743\u9650\u914d\u7f6e\u5b8c\u6210&#xff0c;\u9a8c\u8bc1\u7ed3\u679c&#xff1a;&#034;<\/span><br \/>\n<span class=\"token function\">id<\/span> <span class=\"token string\">&#034;<span class=\"token variable\">${APP_NAME}<\/span>&#034;<\/span><br \/>\n<span class=\"token function\">ls<\/span> <span class=\"token parameter variable\">-la<\/span> <span class=\"token string\">&#034;<span class=\"token variable\">${APP_DIR}<\/span>&#034;<\/span><\/p>\n<p>\u8fd9\u5957\u914d\u7f6e\u5b9e\u73b0\u4e86&#xff1a;\u5e94\u7528\u672c\u8eab\u7528\u4e13\u7528\u4f4e\u6743\u9650\u8d26\u6237\u8fd0\u884c&#xff08;\u65e0\u6cd5\u767b\u5f55\u7cfb\u7edf&#xff09;&#xff1b;\u654f\u611f\u914d\u7f6e\u6587\u4ef6\u8bbe\u4e3a\u4ec5\u6240\u6709\u8005\u53ef\u8bfb&#xff1b;\u8fd0\u7ef4\u4eba\u5458\u901a\u8fc7 sudo \u7ec4\u6388\u6743\u53ef\u4ee5\u91cd\u542f\u670d\u52a1\u548c\u67e5\u770b\u65e5\u5fd7&#xff0c;\u4f46\u62ff\u4e0d\u5230\u5b8c\u6574\u7684 root \u6743\u9650\u2014\u2014\u5373\u4f7f\u8fd0\u7ef4\u8d26\u6237\u7684\u5bc6\u7801\u6cc4\u9732&#xff0c;\u653b\u51fb\u8005\u4e5f\u53ea\u80fd\u64cd\u4f5c\u8fd9\u51e0\u4e2a\u88ab\u660e\u786e\u6388\u6743\u7684\u547d\u4ee4\u3002<\/p>\n<hr \/>\n<h3>\u516b\u3001\u5e38\u89c1\u95ee\u9898\u89e3\u7b54&#xff08;FAQ&#xff09;<\/h3>\n<h4>\u2753 Q1&#xff1a;755 \u548c 644 \u6743\u9650\u7684\u533a\u522b\u662f\u4ec0\u4e48&#xff0c;\u5206\u522b\u7528\u5728\u4ec0\u4e48\u573a\u666f&#xff1f;<\/h4>\n<p>755&#xff08;rwxr-xr-x&#xff09;\u8d4b\u4e88\u4e86\u6267\u884c\u6743\u9650&#xff0c;\u7528\u4e8e\u811a\u672c\u6587\u4ef6&#xff08;.sh&#xff09;\u548c\u53ef\u6267\u884c\u7a0b\u5e8f&#xff1b;644&#xff08;rw-r\u2013r\u2013&#xff09;\u6ca1\u6709\u6267\u884c\u6743\u9650&#xff0c;\u7528\u4e8e\u666e\u901a\u914d\u7f6e\u6587\u4ef6\u3001\u6587\u672c\u6587\u4ef6\u3001JAR \u5305&#xff08;JAR \u5305\u672c\u8eab\u901a\u8fc7 java -jar \u8c03\u7528&#xff0c;\u4e0d\u9700\u8981\u6587\u4ef6\u672c\u8eab\u6709\u6267\u884c\u6743\u9650&#xff09;\u3002\u5224\u65ad\u6807\u51c6\u5f88\u7b80\u5355&#xff1a;\u8fd9\u4e2a\u6587\u4ef6\u9700\u4e0d\u9700\u8981\u88ab\u76f4\u63a5&#034;\u8fd0\u884c&#034;&#xff0c;\u9700\u8981\u5c31\u7ed9 755\/750&#xff0c;\u4e0d\u9700\u8981\u5c31\u7ed9 644\/640\u3002<\/p>\n<h4>\u2753 Q2&#xff1a;chmod -R 777 \u6574\u4e2a\u9879\u76ee\u76ee\u5f55\u80fd\u89e3\u51b3\u6240\u6709\u6743\u9650\u95ee\u9898&#xff0c;\u4e3a\u4ec0\u4e48\u4e0d\u63a8\u8350&#xff1f;<\/h4>\n<p>\u80fd\u89e3\u51b3\u773c\u524d\u7684\u62a5\u9519&#xff0c;\u4f46\u5e26\u6765\u7684\u5b89\u5168\u98ce\u9669\u8fdc\u5927\u4e8e\u89e3\u51b3\u95ee\u9898\u7684\u4fbf\u5229\u3002777 \u610f\u5473\u7740\u7cfb\u7edf\u4e0a\u4efb\u4f55\u7528\u6237&#xff08;\u5305\u62ec\u5c06\u6765\u88ab\u653b\u9677\u540e\u83b7\u5f97\u4f4e\u6743\u9650 shell \u7684\u653b\u51fb\u8005&#xff09;\u90fd\u80fd\u4fee\u6539\u4f60\u7684\u5e94\u7528\u6587\u4ef6\u3001\u8bfb\u53d6\u4f60\u7684\u914d\u7f6e\u6587\u4ef6&#xff08;\u542b\u6570\u636e\u5e93\u5bc6\u7801&#xff09;\u3002\u9047\u5230\u6743\u9650\u62a5\u9519\u5e94\u8be5\u5148\u6392\u67e5\u6839\u56e0\u2014\u2014\u901a\u5e38\u662f\u6587\u4ef6\u6240\u6709\u8005\u4e0d\u5bf9&#xff0c;\u6216\u8005\u8fd0\u884c\u7528\u6237\u4e0d\u5728\u5bf9\u5e94\u7684\u7ec4\u91cc&#xff0c;\u9488\u5bf9\u6027\u4fee\u590d\u6bd4\u65e0\u8111\u653e\u6743\u5b89\u5168\u5f97\u591a\u3002<\/p>\n<h4>\u2753 Q3&#xff1a;useradd \u548c adduser \u6709\u4ec0\u4e48\u533a\u522b&#xff1f;<\/h4>\n<p>useradd \u662f\u5e95\u5c42\u547d\u4ee4&#xff0c;\u884c\u4e3a\u76f8\u5bf9&#034;\u88f8&#034;&#xff0c;\u5f88\u591a\u9ed8\u8ba4\u884c\u4e3a\u4f9d\u8d56\u7cfb\u7edf\u914d\u7f6e&#xff08;\u6bd4\u5982\u662f\u5426\u81ea\u52a8\u521b\u5efa\u4e3b\u76ee\u5f55\u9700\u8981\u624b\u52a8\u52a0 -m&#xff09;\u3002adduser \u662f\u66f4\u53cb\u597d\u7684\u4ea4\u4e92\u5f0f\u811a\u672c&#xff08;\u5728 Debian\/Ubuntu \u7cfb\u7edf\u4e0a&#xff09;&#xff0c;\u4f1a\u5728\u521b\u5efa\u7528\u6237\u65f6\u81ea\u52a8\u8be2\u95ee\u5bc6\u7801\u3001\u5168\u540d\u7b49\u4fe1\u606f&#xff0c;\u5e76\u81ea\u52a8\u521b\u5efa\u4e3b\u76ee\u5f55\u3002\u751f\u4ea7\u81ea\u52a8\u5316\u811a\u672c\u91cc\u66f4\u5e38\u7528 useradd \u56e0\u4e3a\u884c\u4e3a\u53ef\u9884\u6d4b\u3001\u4e0d\u9700\u8981\u4ea4\u4e92\u3002<\/p>\n<h4>\u2753 Q4&#xff1a;\u600e\u4e48\u67e5\u770b\u4e00\u4e2a\u6587\u4ef6\u5177\u4f53\u88ab\u54ea\u4e9b\u7528\u6237\/\u7ec4\u80fd\u8bbf\u95ee&#xff1f;<\/h4>\n<p>ls -l \u80fd\u770b\u5230\u6587\u4ef6\u672c\u8eab\u7684\u6240\u6709\u8005\u3001\u6240\u5c5e\u7ec4\u548c\u4e09\u7c7b\u6743\u9650\u4f4d\u3002\u4f46\u5982\u679c\u8981\u5168\u9762\u5224\u65ad&#034;\u8c01\u80fd\u8bbf\u95ee\u8fd9\u4e2a\u6587\u4ef6&#034;&#xff0c;\u8fd8\u8981\u8003\u8651\u8fd9\u4e2a\u6587\u4ef6\u6240\u5728\u7684\u6240\u6709\u7236\u7ea7\u76ee\u5f55\u662f\u5426\u90fd\u5bf9\u8be5\u7528\u6237\/\u7ec4\u5f00\u653e\u4e86\u6267\u884c&#xff08;\u8fdb\u5165&#xff09;\u6743\u9650&#xff0c;\u6574\u6761\u8def\u5f84\u4e0a\u4efb\u4f55\u4e00\u7ea7\u76ee\u5f55\u6743\u9650\u4e0d\u8db3\u90fd\u4f1a\u5bfc\u81f4\u65e0\u6cd5\u8bbf\u95ee&#xff0c;\u8fd9\u662f\u65b0\u624b\u6392\u67e5\u6743\u9650\u95ee\u9898\u65f6\u6700\u5bb9\u6613\u6f0f\u6389\u7684\u73af\u8282\u3002<\/p>\n<h4>\u2753 Q5&#xff1a;sudo \u548c\u76f4\u63a5\u7528 root \u767b\u5f55\u6709\u4ec0\u4e48\u672c\u8d28\u533a\u522b&#xff1f;<\/h4>\n<p>\u76f4\u63a5\u7528 root \u767b\u5f55\u540e&#xff0c;\u6267\u884c\u7684\u6240\u6709\u64cd\u4f5c\u90fd\u6ca1\u6709&#034;\u662f\u8c01\u5e72\u7684&#034;\u8fd9\u5c42\u8bb0\u5f55&#xff0c;\u4e14\u4e00\u65e6\u8be5\u4f1a\u8bdd\u88ab\u52ab\u6301&#xff0c;\u653b\u51fb\u8005\u83b7\u5f97\u7684\u662f\u5b8c\u6574\u65e0\u9650\u5236\u6743\u9650\u3002sudo \u7684\u4f18\u52bf\u5728\u4e8e&#xff1a;\u6bcf\u6b21\u63d0\u6743\u64cd\u4f5c\u90fd\u4f1a\u8bb0\u5f55\u5728 \/var\/log\/auth.log \u91cc&#xff08;\u8c01\u5728\u4ec0\u4e48\u65f6\u95f4\u6267\u884c\u4e86\u4ec0\u4e48\u547d\u4ee4&#xff09;&#xff0c;\u4e14\u53ef\u4ee5\u7cbe\u7ec6\u5316\u5230\u53ea\u6388\u6743\u7279\u5b9a\u547d\u4ee4&#xff0c;\u800c\u4e0d\u662f\u5168\u90e8\u6743\u9650\u3002\u751f\u4ea7\u73af\u5883\u5e94\u8be5\u7981\u7528 root \u76f4\u63a5 SSH \u767b\u5f55&#xff08;\u540e\u7eed\u7b2c 29 \u7bc7\u5b89\u5168\u52a0\u56fa\u4f1a\u8be6\u7ec6\u8bb2&#xff09;&#xff0c;\u7edf\u4e00\u7528\u666e\u901a\u8d26\u6237 &#043; sudo \u7684\u65b9\u5f0f\u64cd\u4f5c\u3002<\/p>\n<hr \/>\n<h3>\u672c\u7bc7\u5c0f\u7ed3<\/h3>\n<p>&#x1f4cc; \u6838\u5fc3\u7ed3\u8bba&#xff1a;Linux \u6743\u9650\u7ba1\u7406\u7684\u6838\u5fc3\u539f\u5219\u662f\u6700\u5c0f\u6743\u9650\u2014\u2014\u4efb\u4f55\u8d26\u6237\u3001\u4efb\u4f55\u7a0b\u5e8f\u53ea\u5e94\u62e5\u6709\u5b8c\u6210\u5de5\u4f5c\u6240\u5fc5\u9700\u7684\u6700\u5c0f\u6743\u9650\u3002chmod \u7684\u672c\u8d28\u662f 3\u00d73 \u6743\u9650\u77e9\u9635&#xff08;\u6240\u6709\u8005\/\u7ec4\/\u5176\u4ed6\u4eba \u00d7 \u8bfb\/\u5199\/\u6267\u884c&#xff09;&#xff0c;\u6570\u5b57\u6cd5\u662f\u65e5\u5e38\u4f7f\u7528\u6700\u9ad8\u6548\u7684\u65b9\u5f0f\u3002Java SaaS \u5e94\u7528\u5e94\u5f53\u7528\u4e13\u7528\u4f4e\u6743\u9650\u8d26\u6237&#xff08;\u65e0\u767b\u5f55\u80fd\u529b&#xff09;\u8fd0\u884c&#xff0c;\u654f\u611f\u914d\u7f6e\u6587\u4ef6\u4e25\u683c\u9650\u5236\u4e3a\u4ec5\u6240\u6709\u8005\u53ef\u8bfb&#xff0c;sudo \u5e94\u914d\u7f6e\u4e3a\u7cbe\u7ec6\u5316\u6388\u6743\u800c\u975e\u5168\u6743 root&#xff0c;\u4e14\u6c38\u8fdc\u4f7f\u7528 visudo \u7f16\u8f91 sudoers \u6587\u4ef6\u4ee5\u907f\u514d\u8bed\u6cd5\u9519\u8bef\u9501\u6b7b\u7cfb\u7edf\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u672c\u6587\u5bfc\u8bfb&#xff1a;\u672c\u6587\u662f\u7cfb\u5217\u7b2c 4 \u7bc7&#xff0c;\u805a\u7126 Linux \u6743\u9650\u4f53\u7cfb\u3002Java SaaS \u5e94\u7528\u5982\u679c\u7528 root \u6743\u9650\u8fd0\u884c&#xff0c;\u4e00\u65e6\u51fa\u73b0\u5b89\u5168\u6f0f\u6d1e&#xff0c;\u653b\u51fb\u8005\u5c31\u76f4\u63a5\u62ff\u5230\u4e86\u670d\u52a1\u5668\u6700\u9ad8\u6743\u9650\u3002\u672c\u6587\u4f1a\u8bb2\u900f\u7528\u6237\/\u7ec4\u7ba1\u7406\u3001chmod \u6743\u9650\u4f4d\u7684\u672c\u8d28\u3001sudo \u914d\u7f6e&#xff0c;\u5e76\u63d0\u4f9b Spring Boot \u5e94\u7528\u4e13\u7528\u4f4e\u6743\u9650\u7528\u6237\u7684\u6807\u51c6\u914d\u7f6e\u65b9\u6848\u3002\u4e00\u3001\u4e3a\u4ec0\u4e48\u6743\u9650\u7ba1\u7406\u5bf9 Java SaaS \u90e8\u7f72\u81f3\u5173\u91cd\u8981<br \/>\n\u5f88\u591a\u56e2\u961f\u5728\u90e8\u7f72 Spring Boot \u5e94\u7528\u65f6\u56fe\u65b9\u4fbf&amp;#x<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[58,61,43],"topic":[],"class_list":["post-82518","post","type-post","status-publish","format-standard","hentry","category-server","tag-linux","tag-61","tag-43"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Linux\u7b2c04\u7bc7\uff1a\u7528\u6237\u4e0e\u6743\u9650\u7ba1\u7406\u2014\u2014\u591a\u4eba\u534f\u4f5c\u670d\u52a1\u5668\u7684\u5b89\u5168\u57fa\u77f3 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/82518.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Linux\u7b2c04\u7bc7\uff1a\u7528\u6237\u4e0e\u6743\u9650\u7ba1\u7406\u2014\u2014\u591a\u4eba\u534f\u4f5c\u670d\u52a1\u5668\u7684\u5b89\u5168\u57fa\u77f3 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u672c\u6587\u5bfc\u8bfb&#xff1a;\u672c\u6587\u662f\u7cfb\u5217\u7b2c 4 \u7bc7&#xff0c;\u805a\u7126 Linux \u6743\u9650\u4f53\u7cfb\u3002Java SaaS \u5e94\u7528\u5982\u679c\u7528 root \u6743\u9650\u8fd0\u884c&#xff0c;\u4e00\u65e6\u51fa\u73b0\u5b89\u5168\u6f0f\u6d1e&#xff0c;\u653b\u51fb\u8005\u5c31\u76f4\u63a5\u62ff\u5230\u4e86\u670d\u52a1\u5668\u6700\u9ad8\u6743\u9650\u3002\u672c\u6587\u4f1a\u8bb2\u900f\u7528\u6237\/\u7ec4\u7ba1\u7406\u3001chmod \u6743\u9650\u4f4d\u7684\u672c\u8d28\u3001sudo \u914d\u7f6e&#xff0c;\u5e76\u63d0\u4f9b Spring Boot \u5e94\u7528\u4e13\u7528\u4f4e\u6743\u9650\u7528\u6237\u7684\u6807\u51c6\u914d\u7f6e\u65b9\u6848\u3002\u4e00\u3001\u4e3a\u4ec0\u4e48\u6743\u9650\u7ba1\u7406\u5bf9 Java SaaS \u90e8\u7f72\u81f3\u5173\u91cd\u8981 \u5f88\u591a\u56e2\u961f\u5728\u90e8\u7f72 Spring Boot \u5e94\u7528\u65f6\u56fe\u65b9\u4fbf&amp;#x\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/82518.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-07-25T02:09:41+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/82518.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/82518.html\",\"name\":\"Linux\u7b2c04\u7bc7\uff1a\u7528\u6237\u4e0e\u6743\u9650\u7ba1\u7406\u2014\u2014\u591a\u4eba\u534f\u4f5c\u670d\u52a1\u5668\u7684\u5b89\u5168\u57fa\u77f3 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-07-25T02:09:41+00:00\",\"dateModified\":\"2026-07-25T02:09:41+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/82518.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/82518.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/82518.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Linux\u7b2c04\u7bc7\uff1a\u7528\u6237\u4e0e\u6743\u9650\u7ba1\u7406\u2014\u2014\u591a\u4eba\u534f\u4f5c\u670d\u52a1\u5668\u7684\u5b89\u5168\u57fa\u77f3\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Linux\u7b2c04\u7bc7\uff1a\u7528\u6237\u4e0e\u6743\u9650\u7ba1\u7406\u2014\u2014\u591a\u4eba\u534f\u4f5c\u670d\u52a1\u5668\u7684\u5b89\u5168\u57fa\u77f3 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/82518.html","og_locale":"zh_CN","og_type":"article","og_title":"Linux\u7b2c04\u7bc7\uff1a\u7528\u6237\u4e0e\u6743\u9650\u7ba1\u7406\u2014\u2014\u591a\u4eba\u534f\u4f5c\u670d\u52a1\u5668\u7684\u5b89\u5168\u57fa\u77f3 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u672c\u6587\u5bfc\u8bfb&#xff1a;\u672c\u6587\u662f\u7cfb\u5217\u7b2c 4 \u7bc7&#xff0c;\u805a\u7126 Linux \u6743\u9650\u4f53\u7cfb\u3002Java SaaS \u5e94\u7528\u5982\u679c\u7528 root \u6743\u9650\u8fd0\u884c&#xff0c;\u4e00\u65e6\u51fa\u73b0\u5b89\u5168\u6f0f\u6d1e&#xff0c;\u653b\u51fb\u8005\u5c31\u76f4\u63a5\u62ff\u5230\u4e86\u670d\u52a1\u5668\u6700\u9ad8\u6743\u9650\u3002\u672c\u6587\u4f1a\u8bb2\u900f\u7528\u6237\/\u7ec4\u7ba1\u7406\u3001chmod \u6743\u9650\u4f4d\u7684\u672c\u8d28\u3001sudo \u914d\u7f6e&#xff0c;\u5e76\u63d0\u4f9b Spring Boot \u5e94\u7528\u4e13\u7528\u4f4e\u6743\u9650\u7528\u6237\u7684\u6807\u51c6\u914d\u7f6e\u65b9\u6848\u3002\u4e00\u3001\u4e3a\u4ec0\u4e48\u6743\u9650\u7ba1\u7406\u5bf9 Java SaaS \u90e8\u7f72\u81f3\u5173\u91cd\u8981 \u5f88\u591a\u56e2\u961f\u5728\u90e8\u7f72 Spring Boot \u5e94\u7528\u65f6\u56fe\u65b9\u4fbf&amp;#x","og_url":"https:\/\/www.wsisp.com\/helps\/82518.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-07-25T02:09:41+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"7 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/82518.html","url":"https:\/\/www.wsisp.com\/helps\/82518.html","name":"Linux\u7b2c04\u7bc7\uff1a\u7528\u6237\u4e0e\u6743\u9650\u7ba1\u7406\u2014\u2014\u591a\u4eba\u534f\u4f5c\u670d\u52a1\u5668\u7684\u5b89\u5168\u57fa\u77f3 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-07-25T02:09:41+00:00","dateModified":"2026-07-25T02:09:41+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/82518.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/82518.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/82518.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"Linux\u7b2c04\u7bc7\uff1a\u7528\u6237\u4e0e\u6743\u9650\u7ba1\u7406\u2014\u2014\u591a\u4eba\u534f\u4f5c\u670d\u52a1\u5668\u7684\u5b89\u5168\u57fa\u77f3"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/82518","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=82518"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/82518\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=82518"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=82518"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=82518"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=82518"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}