{"id":360,"date":"2019-01-19T12:00:35","date_gmt":"2019-01-19T04:00:35","guid":{"rendered":"http:\/\/www.kejidana.com\/?p=360"},"modified":"2019-01-19T12:00:35","modified_gmt":"2019-01-19T04:00:35","slug":"%e8%84%9a%e6%9c%ac%e5%88%9b%e5%bb%ba%e5%88%a0%e9%99%a4samba%e7%94%a8%e6%88%b7","status":"publish","type":"post","link":"http:\/\/www.kejidana.com\/?p=360","title":{"rendered":"\u811a\u672c\u521b\u5efa\u5220\u9664samba\u7528\u6237"},"content":{"rendered":"<p>\u521b\u5efa\u4e00\u4e2a\u7528\u6237 \u540c\u65f6\u521b\u5efa\u4ed6\u7684\u4e13\u5c5e\u6587\u4ef6\u5939<\/p>\n<pre class=\"lang:sh decode:true\">#!\/bin\/bash  \n#add user  \n#===========================================  \nPASSWD=`cat \/dev\/urandom | head -1 | md5sum | head -c 8`  \nwhile true  \n   do                                       \n      echo -n  \"\u8bf7\u8f93\u5165\u7528\u6237:\"  \n      read id  \n      if [ -z $id ];then  \n               echo -n \"\u4e0d\u80fd\u4e3a\u7a7a!\"  \n         elif grep -w $id \/etc\/passwd &gt;\/dev\/null 2&gt;&amp;1  \n         then  \n                echo -n \"\u91cd\u540d!\"  \n        else  \n#add group  \n        echo  \"\u7ba1\u7406\u7ec4:\"  \ncat &lt;&lt;EOF  \n------------------------------------------------------\n1:\u7f8e\u672f\u7ec4 | 2:\u7b56\u5212\u7ec4 | 3:\u7a0b\u5e8f\u7ec4 | 4:\u8fd0\u8425\u7ec4 | 5:\u7ba1\u7406\u7ec4  \n------------------------------------------------------\nEOF\n   while true  \n      do  \n        echo -n \"\u8bf7\u9009\u62e9\u7ba1\u7406\u7ec4ID:\"  \n        read grp  \n        if [ -z $grp ];then  \n                 echo -n \"\u4e0d\u80fd\u4e3a\u7a7a!\"  \n        else  \n            case $grp in  \n                  1)useradd -g art -s \/sbin\/nologin -M $id  \n                   (echo $PASSWD;sleep 1;echo $PASSWD) | smbpasswd -a -s $id  \n                   mkdir -p \/home\/res\/art\/$id  \n                   chown -R $id: \/home\/res\/art\/$id\n                   ;;  \n                  2)useradd -g design -s \/sbin\/nologin -M $id  \n                   (echo $PASSWD;sleep 1;echo $PASSWD) | smbpasswd -a -s $id  \n                   mkdir -p \/home\/res\/design\/$id  \n                   chown -R $id: \/home\/res\/design\/$id\n                   ;;  \n                  3)useradd -g develop -s \/sbin\/nologin -M $id  \n                   (echo $PASSWD;sleep 1;echo $PASSWD) | smbpasswd -a -s $id  \n                   mkdir -p \/home\/res\/develop\/$id  \n                   chown -R $id: \/home\/res\/develop\/$id\n                   ;;  \n                  4)useradd -g market -s \/sbin\/nologin -M $id  \n                   (echo $PASSWD;sleep 1;echo $PASSWD) | smbpasswd -a -s $id  \n                   mkdir -p \/home\/res\/market\/$id  \n                   chown -R $id: \/home\/res\/market\/$id\n                   ;;  \n                  5)useradd -g manage -s \/sbin\/nologin -M $id  \n                   (echo $PASSWD;sleep 1;echo $PASSWD) | smbpasswd -a -s $id   \n                   mkdir -p \/home\/res\/manage\/$id  \n                   chown -R $id: \/home\/res\/manage\/$id\n                   ;;  \n                  *) echo \"\u8f93\u5165\u9519\u8bef\uff0c\u91cd\u65b0\u8f93\u5165.\"  \n                   ;;  \n           esac  \n        break    \n       fi  \n      done\necho  \"\u5bc6\u7801\uff1a\"$PASSWD  \nbreak  \nfi  \ndone    \necho \"ID:$id  KEY=$PASSWD\" &gt;&gt;~\/ZhangHao.txt<\/pre>\n<pre class=\"lang:sh decode:true \">#!\/bin\/bash  \n#add user  \n#===========================================  \nwhile true  \n   do                                       \n      echo -n  \"\u8bf7\u8f93\u5165\u7528\u6237:\"  \n      read id \n      if [ -z $id ];then  \n               echo -n \"\u4e0d\u80fd\u4e3a\u7a7a!\"  \n      else  \n      \n      userdel $id\n      smbpasswd -x $id\nbreak\nfi  \ndone  \n<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u521b\u5efa\u4e00\u4e2a\u7528\u6237 \u540c\u65f6\u521b\u5efa\u4ed6\u7684\u4e13\u5c5e\u6587\u4ef6\u5939 #!\/bin\/bash #add user #======== [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[14],"tags":[],"class_list":["post-360","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"http:\/\/www.kejidana.com\/index.php?rest_route=\/wp\/v2\/posts\/360","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.kejidana.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.kejidana.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.kejidana.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.kejidana.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=360"}],"version-history":[{"count":0,"href":"http:\/\/www.kejidana.com\/index.php?rest_route=\/wp\/v2\/posts\/360\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.kejidana.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=360"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.kejidana.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=360"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.kejidana.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=360"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}