{"id":35087,"date":"2023-01-10T06:01:07","date_gmt":"2023-01-09T22:01:07","guid":{"rendered":"http:\/\/lrxjmw.cn\/?p=35087"},"modified":"2023-01-10T06:01:39","modified_gmt":"2023-01-09T22:01:39","slug":"linux-su-command","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/linux-su-command.html","title":{"rendered":"Linux\u4e0bsu\u4e0esu -\u547d\u4ee4\u7684\u672c\u8d28\u533a\u522b"},"content":{"rendered":"
\u5bfc\u8bfb<\/td>\n | \u5927\u90e8\u5206Linux\u53d1\u884c\u7248\u7684\u9ed8\u8ba4\u8d26\u6237\u662f\u666e\u901a\u7528\u6237\uff0c\u800c\u66f4\u6539\u7cfb\u7edf\u6587\u4ef6\u6216\u8005\u6267\u884c\u67d0\u4e9b\u547d\u4ee4\uff0c\u9700\u8981root\u8eab\u4efd\u624d\u80fd\u8fdb\u884c\uff0c\u8fd9\u5c31\u9700\u8981\u4ece\u5f53\u524d\u7528\u6237\u5207\u6362\u5230root\u7528\u6237\u3002Linux\u4e2d\u5207\u6362\u7528\u6237\u7684\u547d\u4ee4\u662fsu\u6216su -\u3002\u524d\u5929\u6211\u5728\u4f7f\u7528useradd\u8fd9\u4e2a\u547d\u4ee4\u65f6\uff0c\u624d\u4f53\u4f1a\u5230\u8fd9\u4e24\u8005\u7684\u672c\u8d28\u533a\u522b\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n su\u4e0esu -\u547d\u4ee4\u7684\u672c\u8d28\u533a\u522b<\/strong><\/div>\n \u6211\u9996\u5148\u662f\u7528su\u547d\u4ee4\u5207\u6362\u5230root\u8eab\u4efd\u7684\uff0c\u4f46\u662f\u8fd0\u884cuseradd\u65f6\uff0c\u51fa\u73b0\u9519\u8bef\uff1abash: useradd: command not found\u3002google\u4e86\u4e00\u4e0b\uff0c\u539f\u56e0\u662f\u5728\u8fd9\u4e2a\u7528su\u547d\u4ee4\u5207\u6362\u8fc7\u6765\u7684root\u7528\u6237\u4e0a\u3002<\/p>\n <\/p>\n su\u547d\u4ee4\u548csu -\u547d\u4ee4\u6700\u5927\u7684\u672c\u8d28\u533a\u522b\u5c31\u662f\uff1a\u524d\u8005\u53ea\u662f\u5207\u6362\u4e86root\u8eab\u4efd\uff0c\u4f46Shell\u73af\u5883\u4ecd\u7136\u662f\u666e\u901a\u7528\u6237\u7684Shell\uff1b\u800c\u540e\u8005\u8fde\u7528\u6237\u548cShell\u73af\u5883\u4e00\u8d77\u5207\u6362\u6210root\u8eab\u4efd\u4e86\u3002\u53ea\u6709\u5207\u6362\u4e86Shell\u73af\u5883\u624d\u4e0d\u4f1a\u51fa\u73b0PATH\u73af\u5883\u53d8\u91cf\u9519\u8bef\u3002su\u5207\u6362\u6210root\u7528\u6237\u4ee5\u540e\uff0cpwd\u4e00\u4e0b\uff0c\u53d1\u73b0\u5de5\u4f5c\u76ee\u5f55\u4ecd\u7136\u662f\u666e\u901a\u7528\u6237\u7684\u5de5\u4f5c\u76ee\u5f55\uff1b\u800c\u7528su -\u547d\u4ee4\u5207\u6362\u4ee5\u540e\uff0c\u5de5\u4f5c\u76ee\u5f55\u53d8\u6210root\u7684\u5de5\u4f5c\u76ee\u5f55\u4e86\u3002\u7528echo $PATH\u547d\u4ee4\u770b\u4e00\u4e0bsu\u548csu -\u4ee5\u540e\u7684\u73af\u5883\u53d8\u91cf\u6709\u4f55\u4e0d\u540c\u3002\u4ee5\u6b64\u7c7b\u63a8\uff0c\u8981\u4ece\u5f53\u524d\u7528\u6237\u5207\u6362\u5230\u5176\u5b83\u7528\u6237\u4e5f\u4e00\u6837\uff0c\u5e94\u8be5\u4f7f\u7528su -\u547d\u4ee4\u3002<\/p>\n <\/p>\n Linux\u5c31\u662f\u8fd9\u6837\uff0c\u6709\u65f6\u5019\u914d\u7f6e\u6587\u4ef6\u591a\u4e86\u6216\u8005\u5c11\u4e86\u4e00\u4e2a\u7a7a\u683c\uff0c\u670d\u52a1\u5c31\u8fd0\u884c\u4e0d\u4e86\u3002\u7ec6\u8282\u95ee\u9898\u4e00\u5b9a\u8981\u6ce8\u610f\uff0c\u8fd9\u6837\u624d\u80fd\u5c11\u8d70\u5f2f\u8def\uff01<\/p>\n \n |