> What's the best way to dump a listing of all PTS IDs and all KAS IDs?
>
> I have a feeling we have a bunch of old IDs sitting around which
> should be deleted. Things were, uh, how do I say this nicely...
>
> REALLY REALLY REALLY SCREWED UP AROUND HERE AND I COULD KILL..
>
> err, ahem. Things were messy around here for the last 3 years.
>
>
> So, I'm talking massive AFS audit. PTS groups, IDs, KAS IDs, cross
> checking with /etc/passwd entries, etc. It sounds like Perl is
> going to be my friend (again) in this case.
I had to do a similar audit here. The kas database is easily dumped as
others have reported. The pts database doesn't have a nice mechanism.
I wrote the following shell script for my audit. It runs reasonably
quickly.
================== ptsdump =================
#!/bin/ksh
/usr/afsws/bin/pts listmax | \
read Max user id is maxuid and max group id is maxgid
(( maxgid = maxgid/100 ))
i=$maxgid
while [[ i -le -1 ]]; do
pts examine \
${i}99 ${i}98 ${i}97 ${i}96 ${i}95 ${i}94 ${i}93 ${i}92 ${i}91 ${i}90 \
${i}89 ${i}88 ${i}87 ${i}86 ${i}85 ${i}84 ${i}83 ${i}82 ${i}81 ${i}80 \
${i}79 ${i}78 ${i}77 ${i}76 ${i}75 ${i}74 ${i}73 ${i}72 ${i}71 ${i}70 \
${i}69 ${i}68 ${i}67 ${i}66 ${i}65 ${i}64 ${i}63 ${i}62 ${i}61 ${i}60 \
${i}59 ${i}58 ${i}57 ${i}56 ${i}55 ${i}54 ${i}53 ${i}52 ${i}51 ${i}50 \
${i}49 ${i}48 ${i}47 ${i}46 ${i}45 ${i}44 ${i}43 ${i}42 ${i}41 ${i}40 \
${i}39 ${i}38 ${i}37 ${i}36 ${i}35 ${i}34 ${i}33 ${i}32 ${i}31 ${i}30 \
${i}29 ${i}28 ${i}27 ${i}26 ${i}25 ${i}24 ${i}23 ${i}22 ${i}21 ${i}20 \
${i}19 ${i}18 ${i}17 ${i}16 ${i}15 ${i}14 ${i}13 ${i}12 ${i}11 ${i}10 \
${i}09 ${i}08 ${i}07 ${i}06 ${i}05 ${i}04 ${i}03 ${i}02 ${i}01 ${i}00 \
2> /dev/null
(( i = i + 1))
done
pts examine \
-99 -98 -97 -96 -95 -94 -93 -92 -91 -90 \
-89 -88 -87 -86 -85 -84 -83 -82 -81 -80 \
-79 -78 -77 -76 -75 -74 -73 -72 -71 -70 \
-69 -68 -67 -66 -65 -64 -63 -62 -61 -60 \
-59 -58 -57 -56 -55 -54 -53 -52 -51 -50 \
-49 -48 -47 -46 -45 -44 -43 -42 -41 -40 \
-39 -38 -37 -36 -35 -34 -33 -32 -31 -30 \
-29 -28 -27 -26 -25 -24 -23 -22 -21 -20 \
-19 -18 -17 -16 -15 -14 -13 -12 -11 -10 \
-9 -8 -7 -6 -5 -4 -3 -2 -1 \
2> /dev/null
(( maxuid = maxuid/100 ))
pts examine \
0 1 2 3 4 5 6 7 8 9 \
10 11 12 13 14 15 16 17 18 19 \
20 21 22 23 24 25 26 27 28 29 \
30 31 32 33 34 35 36 37 38 39 \
40 41 42 43 44 45 46 47 48 49 \
50 51 52 53 54 55 56 57 58 59 \
60 61 62 63 64 65 66 67 68 69 \
70 71 72 73 74 75 76 77 78 79 \
80 81 82 83 84 85 86 87 88 89 \
90 91 92 93 94 95 96 97 98 99 \
2> /dev/null
i=1
while [[ i -le $maxuid ]]; do
pts examine \
${i}00 ${i}01 ${i}02 ${i}03 ${i}04 ${i}05 ${i}06 ${i}07 ${i}08 ${i}09 \
${i}10 ${i}11 ${i}12 ${i}13 ${i}14 ${i}15 ${i}16 ${i}17 ${i}18 ${i}19 \
${i}20 ${i}21 ${i}22 ${i}23 ${i}24 ${i}25 ${i}26 ${i}27 ${i}28 ${i}29 \
${i}30 ${i}31 ${i}32 ${i}33 ${i}34 ${i}35 ${i}36 ${i}37 ${i}38 ${i}39 \
${i}40 ${i}41 ${i}42 ${i}43 ${i}44 ${i}45 ${i}46 ${i}47 ${i}48 ${i}49 \
${i}50 ${i}51 ${i}52 ${i}53 ${i}54 ${i}55 ${i}56 ${i}57 ${i}58 ${i}59 \
${i}60 ${i}61 ${i}62 ${i}63 ${i}64 ${i}65 ${i}66 ${i}67 ${i}68 ${i}69 \
${i}70 ${i}71 ${i}72 ${i}73 ${i}74 ${i}75 ${i}76 ${i}77 ${i}78 ${i}79 \
${i}80 ${i}81 ${i}82 ${i}83 ${i}84 ${i}85 ${i}86 ${i}87 ${i}88 ${i}89 \
${i}90 ${i}91 ${i}92 ${i}93 ${i}94 ${i}95 ${i}96 ${i}97 ${i}98 ${i}99 \
2> /dev/null
(( i = i + 1))
done
exit 0
================== ptsdump =================
...Tim
Tim Theisen Associate Researcher
Internet: [EMAIL PROTECTED] Department of Computer Sciences
UUCP: uwvax!tim University of Wisconsin-Madison
Phone: (608)262-0438 1210 West Dayton Street
FAX: (608)262-9777 Madison, WI 53706-1685