admin scripts
Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

71 Zeilen
1.6 KiB

  1. #!/bin/bash
  2. # Quick ldap search tool
  3. # ver 0.1 sonic - I will never ever update this
  4. # ver 0.2 koffee - quick update & shell checking
  5. SCRIPTNAME="rbsearch"
  6. EMAIL="bill.gates@hotmail.com"
  7. USERNAME="microbg"
  8. FULLNAME="Bill Gates"
  9. SEARCH="ldapsearch -D cn=root,ou=ldap,o=redbrick -xLLL -y /etc/ldap.secret"
  10. case $1 in
  11. -update)
  12. if [ ! -z $3 ]; then
  13. $SEARCH "cn=*$2*$3" uid yearsPaid loginShell
  14. else
  15. echo "Usage: $SCRIPTNAME -fullname $FULLNAME"
  16. fi
  17. ;;
  18. -altmail)
  19. $SEARCH "altmail=$2" uid
  20. ;;
  21. -uid)
  22. $SEARCH "uid=$2"
  23. ;;
  24. -id)
  25. $SEARCH "id=$2" uid
  26. ;;
  27. -name)
  28. $SEARCH "cn=*$2*" uid
  29. ;;
  30. -nick)
  31. $SEARCH "gecos=*$2*" uid
  32. ;;
  33. -fullname)
  34. if [ ! -z $3 ]; then
  35. $SEARCH "cn=*$2*$3" uid
  36. else
  37. echo "Usage: $SCRIPTNAME -fullname $FULLNAME"
  38. fi
  39. ;;
  40. -newbie)
  41. $SEARCH "newbie=TRUE" uid
  42. ;;
  43. -h)
  44. echo "Usage: $SCRIPTNAME [-altmail] [-uid] [-id] [-name] -[nick] -[fullname] query"
  45. echo "eg. $SCRIPTNAME -altmail $EMAIL"
  46. echo " $SCRIPTNAME -uid $USERNAME"
  47. echo " $SCRIPTNAME -fullname $FULLNAME"
  48. echo " $SCRIPTNAME -update $USERNAME"
  49. echo ""
  50. echo "Only fullname takes 2 arguments."
  51. echo "All results will give just uid(s) apart from [-uid]"
  52. echo "[-uid] prints all ldap info for that uid"
  53. ;;
  54. *)
  55. echo "Usage: $SCRIPTNAME [-altmail] [-uid] [-id] [-name] -[nick] -[fullname] query"
  56. echo "eg. $SCRIPTNAME -altmail $EMAIL"
  57. echo " $SCRIPTNAME -uid $USERNAME"
  58. echo " $SCRIPTNAME -fullname $FULLNAME"
  59. echo " $SCRIPTNAME -update $USERNAME"
  60. echo ""
  61. echo "Only fullname takes 2 arguments."
  62. echo "All results will give just uid(s) apart from [-uid]"
  63. ;;
  64. esac