首页 > 其他 > 详细

简单的账号查询

时间:2016-03-26 08:46:05      阅读:174      评论:0      收藏:0      [点我收藏+]

1:依次向/etc/passwd目录中的每一个用户问好,并指出其UID号!(eg:HELLO,root,your uid is 0)
2:统计这个脚本共有多少个账户?

#!/bin/bash
a="/etc/passwd"
b="/root/b"
if  awk -F: ‘{print "hello," $1"," " your uid is " $3 }‘ $a > $b
then
  cat $b
  awk ‘{print $2}‘ $b |wc -l
fi

[root@slave1 ~]# sh  aaa

hello,root, your uid is 0

hello,bin, your uid is 1

hello,daemon, your uid is 2

hello,adm, your uid is 3

hello,lp, your uid is 4

hello,sync, your uid is 5

hello,shutdown, your uid is 6

hello,halt, your uid is 7

hello,mail, your uid is 8

hello,uucp, your uid is 10

hello,operator, your uid is 11

hello,games, your uid is 12

hello,gopher, your uid is 13

hello,ftp, your uid is 14

hello,nobody, your uid is 99

hello,vcsa, your uid is 69

hello,saslauth, your uid is 499

hello,postfix, your uid is 89

hello,sshd, your uid is 74

hello,mysql, your uid is 500

hello,php-fpm, your uid is 501

hello,ntp, your uid is 38

hello,named, your uid is 25

hello,zabbix, your uid is 498

hello,memcached, your uid is 497

hello,redis, your uid is 503

hello,mailnull, your uid is 47

hello,smmsp, your uid is 51

28



本文出自 “Steven一直不放弃” 博客,请务必保留此出处http://wsw26.blog.51cto.com/1442148/1755056

简单的账号查询

原文:http://wsw26.blog.51cto.com/1442148/1755056

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!