How to set root password on MacBook
By gc on Dec 18, 2008
I got a MacBook Pro recently. It works great for both at home and work. I started to debug OpenSSO issues on this lapto. OpenSSO relies on cookie to do single sign on. Though OpenSSO can be deployed on tomcat and up running, but I couldn't access OpenSSO console. Authentication passes OK, but cookie is not set. You got to have a cookie domain in order to set cookie. Localhost does not work.
That is simple, all I need is to add some fake domain/host names to /etc/hosts file. However, only root user can access this file. Wait a second, when I started to use this MacBook, it never asked to set root password. What can I do? search the internet. I found a few ways quickly, like inserting in the OS disk. I don't have the disk with me. Here is another one, Open Directory Utility -> Click the lock in the Directory Utility window -> Enter an administrator account name and password, then click OK -> Choose Enable Root User from the Edit menu -> Enter the root password you wish to use in both the Password and Verify fields, then click OK. I don't know what is the admin account. I only have one user on this laptop. I inputed my password, but nothing happened.
Just before I started looking for the OS disk, I discovered this trick "sudo passwd root". Dude, it is so easy. I can't believe it! But is this a security hole of Mac OS X ......