Saturday, February 26, 2011

Missing admin accounts on Mac: FIX

Shut down the computer if it is on.
Press the power button to start the computer.
Immediately press and hold the Command (Apple) key and the "s" key for single-user mode.
Type "mount -uw /" and press return.
Type "passwd" and press return.
 Enter new password (this will be for the root user account) and press return.
Type "reboot" and press return.
Enter Account settings and when prompted for administrator account and password, use the user name root and the password you just setup
Check box for you standard account to administrate box
 If all goes well you are admin again.

Then log in as Root:

dscl . -create /Groups/admin
dscl . -create /Groups/admin RealName Administrators
dscl . -create /Groups/admin PrimaryGroupID 80
dscl . -create /Groups/admin Password [password]
dscl . -create /Groups/admin GroupMembership root

Original post:  http://macosx.com/forums/howto-faqs/299801-howto-fix-user-lost-administrator-privileges.html

Wednesday, February 23, 2011

Convert plist to xml

plutil -convert xml1 your_file.plist
To convert an XML .plist file to binary for use: 
plutil -convert binary1 your_file.plist

Wednesday, February 9, 2011

Remove an ODM from the command line

To remove an Open Directory Master first delete the LDAP entries in Directory Services and then open the Terminal and type:


sudo slapconfig -destroyldapserver

It will take a while to complete.  After it has finished you should be able to remove the Opendirectory and DNS services from Server Manager (restart will be required).

Saturday, December 18, 2010

Bound Leopard Server not allowing SMB or AFP connections

Problem:  A 10.5.8 server was not allowing SMB or AFP connections.  The server was bound to AD but "id" commands were failing- sometimes.

Looking at the logs I saw that they were filled with launchd errors:

 com.apple.launchd[1] (org.openldap.slapd): Throttling respawn: Will start in 10

These were causing very, very poor performance and pretty much preventing Directory Service from operating; that in turn prevented any logins.

The first thing I attempted was to unbind the server but as it couldn't connect to the domain I did a Force Unbind, deleted the edu.mit.kerberos file and the Directory Services folder and restarted.  I then re-bound the server and immediately unbound: this ensured that the server's AD account would be removed.

From the unbound server I took these actions:
  • Changed the Windows role to Standalone server
  • Stopped the SMB services
  • Opened Terminal and ran "sudo –s /usr/libexec/slapd –Tt"
This returned:

could not stat config file "/etc/openldap/slapd.conf": No such file or directory (2)
slaptest: bad configuration file!
I then viewed the contents of the directory:  cd /etc/openldap/ls

There was no slapd.conf file present but there was a slapd.conf.default file so I renamed  it: "cp slapd.conf.default slapd.conf"
I then re-ran the slapd command:  "/usr/libexec/slapd –Tt" and it returned:

bdb_db_open: Warning - No DB_CONFIG file found in directory /private/var/db/openldap/openldap-data: (2)
Expect poor performance for suffix dc=my-domain,dc=com.
config file testing succeeded

Since LDAPv3 is turned off in Directory Services this shouldn't be a problem
  • Reboot 
  • Launch Server Manager
  • Change the Windows role to Domain Member
  • Start the SMB service
AFP and SMB log-ins now worked.

These steps and more info can be found here:  http://discussions.apple.com/message.jspa?messageID=10613310