机器新建用户检查

来源:互联网 发布:苹果内存清理软件 编辑:程序博客网 时间:2024/05/01 09:32

用途:检查机器是否新建了用户

remote_cmd="grep -v  'root:x\|daemon:x\|lp:x\|mail:x\|news:x\|uucp:x\|games:x\|man:x\|wwwrun:x\|ftp:x\|nobody:x\|messagebus:x\|sshd:x\|polkitd:x\|nscd:x\|rpc:x\|openslp:x\|tftp:x\|usbmux:x\|ntp:x:\|at:x:\|vnc:x:\|rtkit:x:\|pulse:x:\|statd:x:\|ftpsecure:x:\|postfix:x:\|scard:x:\|gdm:x:admin:x:\|db2inst1:x:\|db2ifen1:x:\|mqm:x:\|mysql:x:\|bin:x:\|lp:x:\|gdm:x:\|admin:x:' /etc/passwd"
 echo "66.3.47.19      "
ssh root@66.3.47.19 "$remote_cmd"
 echo "66.3.47.20      "
ssh root@66.3.47.20 "$remote_cmd"
 echo "66.3.47.21      "
ssh root@66.3.47.21 "$remote_cmd"
 echo "66.3.47.22      "
ssh root@66.3.47.22 "$remote_cmd"
 echo "66.3.47.23      "
ssh root@66.3.47.23 "$remote_cmd"
 echo "66.3.47.24      "
ssh root@66.3.47.24 "$remote_cmd"
 echo "66.3.47.25      "
ssh root@66.3.47.25 "$remote_cmd"
 echo "66.3.47.26      "
ssh root@66.3.47.26 "$remote_cmd"
 echo "66.3.47.27      "
ssh root@66.3.47.27 "$remote_cmd"
 echo "66.3.47.32      "
ssh root@66.3.47.32 "$remote_cmd"
 echo "66.3.47.33     "
ssh root@66.3.47.33 "$remote_cmd"
 echo "66.3.47.34      "
ssh root@66.3.47.34 "$remote_cmd"
 echo "66.3.47.35      "
ssh root@66.3.47.35 "$remote_cmd"
 echo "66.3.47.36     "
ssh root@66.3.47.36 "$remote_cmd"
 echo "66.3.47.37      "
ssh root@66.3.47.37 "$remote_cmd"
 echo "66.3.47.38      "
ssh root@66.3.47.38 "$remote_cmd"
 echo "66.3.47.39      "
ssh root@66.3.47.39 "$remote_cmd"
 echo "66.3.47.40      "
ssh root@66.3.47.40 "$remote_cmd"
 echo "66.3.47.41     "
ssh root@66.3.47.41 "$remote_cmd"
 echo "66.3.47.42      "
ssh root@66.3.47.42 "$remote_cmd"
 echo "66.3.47.43      "
ssh root@66.3.47.43 "$remote_cmd"
 echo "66.3.47.44      "
ssh root@66.3.47.44 "$remote_cmd"
 echo "66.3.47.45      "
ssh root@66.3.47.45 "$remote_cmd"
 echo "66.3.47.46      "
ssh root@66.3.47.46 "$remote_cmd"
 echo "66.3.47.47      "
ssh root@66.3.47.47 "$remote_cmd"


原理:机器新建后,查看/etc/passwd文件,确认哪些是默认用户,将默认用户排除掉即可。用“root:x:”排除更准确。

0 0