Advertisement
Guest User

Untitled

a guest
Jun 6th, 2016
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.98 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3.  
  4. cat /etc/passwd | cut -d : -f 1-4 | while read userdata
  5. do
  6.         id=`echo "$userdata" | cut -d : -f 3 `
  7.         gid=`echo "$userdata" | cut -d : -f 4`
  8.         name=`echo "$userdata" | cut -d : -f 1`
  9.         if [ $id -ge 1001 ] && [ $id -le 1300 ]
  10.         then
  11.                 #gname=""
  12.                 pass=`< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c${1:-32}`
  13.                 #echo $pass
  14.                 echo -e "$pass\n$pass" | passwd $name
  15.  
  16.  
  17.  
  18.                 #passwd $name
  19.                 #echo "ID: $id  Name=$name Gid=$gid"
  20. #               for x in `cat /etc/group | cut -d : -f -3`
  21. #               do
  22. #                       ggid=`echo "$x" | cut -d : -f 3`
  23. #                       ggname=`echo "$x" | cut -d : -f 1`
  24.  
  25. #                       if [ $ggid -eq $gid ]
  26. #                       then
  27. #                               echo "UID: $id User: $name Gid=$gid Gname=$ggname"
  28. #                       fi
  29.  
  30. #
  31. #               done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement