Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

damacus

macrumors member
Original poster
Jun 11, 2007
48
4
Hello,

I've written a rather nice and comprehensive PHP-based frontend for OSX server, however one issue I have is that I can only check whether a user is enabled or disabled one at a time, and only by calling into the server as root and issuing the below command (in this example to check mdavid) and then parsing the line to check if isDisabled=1 (locked) or =0 (unlocked).

pwpolicy -a diradmin -p <diradmin pw> -u mdavid -getpolicy

However, this means in my web user list, I will always list everyone (we have over 2,000 disabled users on our mail server) and on top of that won't be able to show status at least without doing many, many commands.

In best case, I'd be able to get this information from LDAP. I saw in the Apple Open Directory Admin 10.5 2nd Edition manual that there's some attribute called apple-user-passwordpolicy ... but I can't find it anywhere in LDAP! Do I have to do something special to enable this?

Failing that, under linux, the command "passwd -a -S" prints a list of all users and a code P/L (L is locked) as well as pwd expiration data. This style of using one command to get the status for everyone would also be sufficient.

Anyone have any ideas? Any help would be greatly appreciated.

Thanks,
Michael
 

yellow

Moderator emeritus
Oct 21, 2003
16,018
6
Portland, OR
Off the top of my head, I would expect "dscl" (directory service command line utility) to be able to get this info.. though I don't know the particulars. Check the man page on it.
 

damacus

macrumors member
Original poster
Jun 11, 2007
48
4
Off the top of my head, I would expect "dscl" (directory service command line utility) to be able to get this info.. though I don't know the particulars. Check the man page on it.

Thanks for your response. Unfortunately, I've spent a bit of time in dscl already and I see no difference between the data before or after locking.

pwpolicy -a diradmin -u mdavid -setpolicy "isDisabled=0"
dscl /LDAPv3/127.0.0.1 -read /Users/mdavid > mdavid1
pwpolicy -a diradmin -u mdavid -setpolicy "isDisabled=1"
dscl /LDAPv3/127.0.0.1 -read /Users/mdavid > mdavid2
diff mdavid1 mdavid2

This shows no difference (at least in /Users/) between accounts that are locked and unlocked. As for the rest of the directory, I didn't see any information in the other paths that would seem to relate to user status.

Any thoughts?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.