linux\u7528\u6237\u7ec4\u7ba1\u7406<\/strong>\uff0c\u53ef\u7528\u4e8e\u964d\u4f4e\u7528\u6237\uff0c\u5e76\u6307\u5b9a\u7528\u6237\u7ec4<\/p>\n8\u3001usermod<\/p>\n
\u5728\u540e\u9762\u8bf4\u4e86\u5173\u4e8euseradd\u7684\u5de5\u5177\uff0c\u800cusermod\u5de5\u5177\u548cuseradd\u7684\u53c2\u6570\u5dee\u4e0d\u591a\uff1b\u4e8c\u8005\u4e0d\u540c\u4e4b\u5904\u5728\u4e8euseradd\u662f\u6dfb\u52a0\uff0cusermod\u662f\u66f4\u6539\uff1b<\/p>\n
<\/p>\n
usermod\u9664\u4e86\u80fd\u6539\u7528\u6237\u7684SHELL\u7c7b\u578b\uff0c\u6240\u5f52\u5c5e\u7684\u7528\u6237\u7ec4\uff0c\u4e5f\u80fd\u6539\u7528\u6237\u5bc6\u7801\u7684\u6709\u6548\u671f\uff0c\u80fd\u591f\u6539\u767b\u9646\u540d\u3002usermod\u8fd9\u4e48\u770b\u6765\u5c31\u662f\u80fd\u505a\u5230\u7528\u6237\u5e10\u53f7\u5927\u8f6c\u79fb\uff1b\u4f8b\u5982\u6211\u628a\u7528\u6237A\u6539\u4e3a\u65b0\u7528\u6237B\uff1a<\/p>\n
\u4e0b\u8ff0\u4e3ausermod\u53ef\u9009\u7528\u7684\u53c2\u6570\uff1a<\/p>\n
-ccomment<\/p>\n
\u66f4\u65b0\u7528\u6237\u5e10\u53f7password\u6863\u4e2d\u7684\u6ce8\u89e3\u680f\uff0c\u901a\u5e38\u662f\u4f7f\u7528chfn(1)\u6765\u66f4\u6539<\/p>\n
-dhome_dir<\/p>\n
\u66f4\u65b0\u7528\u6237\u65b0\u7684\u767b\u9646\u76ee\u5f55\u3002\u5018\u82e5\u7ed9\u5b9a-m\u9009\u9879\uff0c\u7528\u6237\u65e7\u76ee\u5f55\u4f1a\u8fc1\u5f80\u65b0\u7684\u76ee\u5f55\u53bb\uff0c\u5982\u65e7\u76ee\u5f55\u4e0d\u5b58\u5728\u5219\u5efa\u4e2a\u65b0\u7684<\/p>\n
-eexpire_date<\/p>\n
\u52a0\u4e0a\u7528\u6237\u5e10\u53f7\u505c\u6b62\u65e5\u671f\u3002\u65e5\u671f\u683c\u5f0f\u4e3aMM\/DD\/YY.<\/p>\n
-finactive_days<\/p>\n
\u5e10\u53f7\u8fc7\u671f\u51e0\u65e5\u540e\u6c38\u4e45\u505c\u6743\u3002\u5f53\u503c\u4e3a0\u65f6\u5e10\u53f7\u5219\u7acb\u5373\u88ab\u505c\u6743\u3002\u800c\u5f53\u503c\u4e3a-1\u65f6\u5219\u5173\u6389\u6b64\u529f\u80fd\u3002\u9884\u8bbe\u503c\u4e3a-1<\/p>\n
-ginitial_group<\/p>\n
\u66f4\u65b0\u7528\u6237\u65b0\u7684\u8d77\u59cb\u767b\u5f55\u7528\u6237\u7ec4\u3002\u7528\u6237\u7ec4\u540d\u987b\u5df2\u5b58\u5728\u3002\u7528\u6237\u7ec4ID\u5fc5\u987b\u53c2\u7167\u65e2\u6709\u7684\u7684\u7528\u6237\u7ec4\u3002\u7528\u6237\u7ec4ID\u9884\u8bbe\u503c\u4e3a1<\/p>\n
-Ggroup,[...]<\/p>\n
<\/p>\n
\u5b9a\u4e49\u7528\u6237\u4e3a\u4e00\u5806groups\u7684\u6210\u5458\u3002\u6bcf\u4f4d\u7528\u6237\u7ec4\u4f7f\u7528\",\"\u533a\u683c\u5f00\u6765\uff0c\u4e0d\u53ef\u4ee5\u53c2\u6742\u7a7a\u767d\u5b57\u5143\u3002\u7528\u6237\u7ec4\u540d\u540c-g\u9009\u9879\u7684\u9650\u5236\u3002\u5047\u5982\u7528\u6237\u73b0\u4eca\u7684\u7528\u6237\u7ec4\u4e0d\u518d\u6b64\u5217\uff0c\u5219\u5c06\u7528\u6237\u7531\u8be5\u7528\u6237\u7ec4\u4e2d\u79fb\u9664\u3002<\/p>\n
-llogin_name<\/p>\n
\u53d8\u66f4\u7528\u6237login\u65f6\u7684\u540d\u79f0\u4e3alogin_name\u3002\u5176\u5b83\u4e0d\u53d8\u3002\u975e\u5e38\u662f\uff0c\u7528\u6237\u76ee\u5f55\u540d\u5e94\u5f53\u4e5f\u4f1a\u8ddf\u968f\u66f4\u52a8\u6210\u65b0\u7684\u767b\u5f55\u540d\u3002<\/p>\n
-sshell<\/p>\n
\u6307\u5b9a\u65b0\u767b\u5f55shell\u3002\u8fd9\u4e48\u680f\u7559\u767dlinux\u7528\u6237\u7ec4\u7ba1\u7406<\/strong>\uff0c\u7cfb\u7edf\u5c06\u9009\u7528\u7cfb\u7edf\u9884\u8bbeshell\u3002<\/p>\n-uuid<\/p>\n
\u7528\u6237ID\u503c\u3002\u5fc5\u987b\u4e3a\u60df\u4e00\u7684ID\u503c\uff0c\u9664\u975e\u7528-o\u9009\u9879\u3002\u6570\u5b57\u4e0d\u53ef\u4e3a\u8d1f\u503c\u3002\u9884\u8bbe\u4e3a\u6700\u5c0f\u4e0d\u5f97\u5927\u4e8e\/etc\/login.defs\u4e2d\u5b9a\u4e49\u7684UID_MIN\u503c\u30020\u5230UID_MIN\u503c\u4e4b\u95f4\u662f\u4f20\u7edf\u4e0a\u4fdd\u7559\u7ed9\u7cfb\u7edf\u5e10\u53f7\u4f7f\u7528\u3002\u7528\u6237\u76ee\u5f55\u6811\u4e0b\u6240\u6709\u7684\u6863\u6848\u76ee\u5f55\u5176userID\u4f1a\u624b\u52a8\u6539\u53d8\u3002\u7f6e\u4e8e\u7528\u6237\u76ee\u5f55\u5916\u7684\u6863\u6848\u5219\u8981\u81ea\u884c\u81ea\u52a8\u66f4\u52a8\u3002<\/p>\n
\u6ce8\u610f:usermod\u4e0d\u5bb9\u8bb8\u4f60\u6539\u53d8\u6b63\u5728\u7ebf\u4e0a\u7684\u7528\u6237\u5e10\u53f7\u540d\u79f0\u3002\u5f53usermod\u62ff\u6765\u6539\u53d8userID,\u5fc5\u987b\u786e\u8ba4\u8fd9\u540duser\u6ca1\u5728\u7b14\u8bb0\u672c\u4e0a\u6267\u884c\u4efb\u4f55\u7a0b\u5e8f\u3002<\/p>\n
\u4f8b\uff1a<\/p>\n
\u628alinuxfish\u7528\u6237\u540d\u6539\u4e3afishlinux\uff0c\u800c\u4e14\u628a\u5176\u5bb6\u76ee\u5f55\u8f6c\u79fb\u5230\/opt\/linuxfish;<\/p>\n
\n
usermod -d \/opt\/linuxfish -m -l fishlinux -U linuxfish<\/code><\/pre>\n<\/p>\n<\/p>\n
\u67e5\u770b\u7528\u6237fishlinux\u7684\u5bb6\u76ee\u5f55\u4e0b\u7684\u6587\u4ef6\u53ca\u5c5e\u4e3b\uff1b<\/p>\n
\n
ls -la \/opt\/linux\/you\/\n\u603b\u7528\u91cf 48\ndrwxr-xr-x 3 fishlinux linuxfish 4096 11 \u6708 5 16:46 .\ndrwxrwxrwx 29 root root 4096 11 \u6708 5 16:48 ..\n-rw-r--r-- 1 fishlinux linuxfish 24 11 \u6708 5 16:46 .bash_logout\n-rw-r--r-- 1 fishlinux linuxfish 191 11 \u6708 5 16:46 .bash_profile\n-rw-r--r-- 1 fishlinux linuxfish 124 11 \u6708 5 16:46 .bashrc\n-rw-r--r-- 1 fishlinux linuxfish 5619 11 \u6708 5 16:46 .canna\n-rw-r--r-- 1 fishlinux linuxfish 438 11 \u6708 5 16:46 .emacs\n-rw-r--r-- 1 fishlinux linuxfish 120 11 \u6708 5 16:46 .gtkrc\ndrwxr-xr-x 3 fishlinux linuxfish 4096 11 \u6708 5 16:46 .kde\n-rw-r--r-- 1 fishlinux linuxfish 0 11 \u6708 5 16:46 mydoc.txt\n-rw-r--r-- 1 fishlinux linuxfish 658 11 \u6708 5 16:46 .zshrc<\/code><\/pre>\n<\/p>\n\u67e5\u770b\u6709\u5173fishlinux\u7684\u8bb0\u5f55<\/p>\n
\n
more \/etc\/passwd |grep fishlinux\n\u00a0\n\u00a0fishlinux:x:512:512::\/opt\/linuxfish:\/bin\/bash<\/code><\/pre>\n<\/p>\n\u901a\u8fc7\u524d\u9762\u7684\u4e8b\u4f8b\uff0c\u6211\u4eec\u53d1\u89c9\u6587\u4ef6\u7684\u7528\u6237\u7ec4\u8fd8\u6ca1\u6709\u53d8\uff0c\u5047\u82e5\u60a8\u60f3\u6539\u53d8\u4e3afishlinux\u7528\u6237\u7ec4\uff0c\u5047\u5982\u60f3\u7528\u901a\u8fc7usermod\u6765\u66f4\u6539linux\u64cd\u4f5c\u7cfb\u7edf\u539f\u7406\uff0c\u5c31\u8981\u5148\u6dfb\u52a0fishlinux\u7528\u6237\u7ec4\uff1b\u4e4b\u540e\u7528usermod-g\u6765\u66f4\u6539\uff0c\u4e5f\u53ef\u4ee5\u7528chown-Rfishlinux:fishlinux\/opt\/finshlinux\u6765\u6539\uff1b<\/p>\n
\u8b66\u544a\uff1a<\/p>\n
usermod\u6700\u597d\u4e0d\u8981\u7528\u5b83\u6765\u6539\u7528\u6237\u7684\u5bc6\u7801\uff0c\u7531\u4e8e\u4ed6\u5728\/etc\/shadow\u4e2d\u663e\u793a\u7684\u662f\u660e\u53e3\u4ee4\uff1b\u66f4\u6539\u7528\u6237\u7684\u53e3\u4ee4\u6700\u597d\u7528passwd\uff1b<\/p>\n","protected":false},"excerpt":{"rendered":"
\u5b83\u53ef\u4ee5\u663e\u793a\u7528\u6237\u7684\u767b\u5f55\u540d\u3001\u771f\u5b9e\u59d3\u540d\u3001\u5bb6\u76ee\u5f55\u3001\u4f7f\u7528\u7684Shell\u3001\u767b\u5f55\u72b6\u6001\u3001\u90ae\u4ef6\u72b6\u6001\u7b49\u4fe1\u606f\u3002\u7c7b\u578b\uff0c\u6240\u5f52\u5c5e\u7684\u7528\u6237\u7ec4\uff0c\u4e5f\u80fd\u6539\u7528\u6237\u5bc6\u7801\u7684\u6709\u6548\u671f\uff0c\u8fd8\u80fd\u6539\u767b\u5f55\u540d\u3002\u66f4\u65b0\u7528\u6237\u8d26\u53f7password\u6863\u4e2d\u7684\u6ce8\u89e3\u680f\uff0c\u4e00\u822c\u662f\u4f7f\u7528chfn(1)\u6765\u4fee\u6539\u66f4\u65b0\u7528\u6237\u65b0\u7684\u8d77\u59cb\u767b\u5165\u7528\u6237\u7ec4\u3002\u7279\u522b\u662f\uff0c\u7528\u6237\u76ee\u5f55\u540d\u5e94\u8be5\u4e5f\u4f1a\u8ddf\u7740\u66f4\u52a8\u6210\u65b0\u7684\u767b\u5165\u540d\u3002<\/p>\n","protected":false},"author":1,"featured_media":295338,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[988],"tags":[5357,5356,5359,5358,5355],"class_list":["post-295337","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tougao","tag-pgn","tag-cxzlxj","tag-yhxxxs","tag-yhzqh","tag-zhyhgl"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/295337","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\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=295337"}],"version-history":[{"count":0,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/295337\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/295338"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=295337"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=295337"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=295337"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}