标签:linux shell 编程语言
linux系统-shell编程-几个shell脚本
一 灭掉用户 killuser.sh
#!/bin/sh
# The script to kill login user
user_name="$1"
/bin/ps aux | /bin/grep $user_name | /bin/awk `{ print $2 }` > /tmp/temp.pid
kill_id=`cat /tmp/temp.pid`
for PID in kill_id
do
/bin/kill -9 $PID 2> /dev/null
done
二 批量添加用户useradd.sh
#/bin/sh
echo "input name"
read name
echo "input num"
read num
n=1
while [ $n -le $num ]
do
/usr/bin/useradd $name$n
n=`expr $n + 1`
done
echo "please input the passwd"
read passwd
m=1
while [ $m -le $num ]
do
echo $passwd | /usr/bin/passwd --stdin $name$m
m=`expr $m + 1`
done
三 检查系统的SetUID setuid.sh
#!/bin/sh
mkdir /backup
/usr/bin/find / -perm -4000 -o -2000 > /tmp/setuid.check 2> /dev/null
for file in `/bin/cat /tmp/setuid.list > /dev/null`
do
/bin/grep $file /backup/setuid.list > /dev/null
if [ "#? != "0" ]
then
echo "$file is not in list"
fi
done
/bin/rm /tmp/setuid.check
附:my_qq 872785786 及linux系统基础相应的网盘资料链接:http://pan.baidu.com/s/1ydewA 密码:kaek
欢迎一起交流学习-安卓嵌入式开发,若想免费获取更多资料,请联系我即可-共享精神,提供1000G+的技术资料
ios,安卓,嵌入式,及各种编程语言
linux系统-shell编程-几个shell脚本
标签:linux shell 编程语言
原文地址:http://blog.csdn.net/qq_22075977/article/details/45126057