Wednesday, April 22, 2009

Reset root password in Mac OS X

Today I wanted to perform some urgent task with DNS redirection using 'hosts' file in my Mac OS X (10.5.6). Being an administrator I tried doing it, but I found the file is opened in read-only mode. Unfortunately I didn't know root password, which was very embarrassing to myself. I have been playing with root level accounts for many years on different Linux flavors, but here I am stuck coz I am feeling like school kid in front of computer.

I had no other option than resetting root password, which I realized a very useful recovery system keeping computers up again within maximum of 4-5 minutes. Below is a small exercise I tried with me today, and found working:

Steps:

1. Start/Restart your computer.
2. Immediately press and hold the Command (Apple) key and one of the following:
  • the "s" key for single-user mode. (Command-S)
  • the "v" key for verbose mode. (Command-V)
Soon you will start seeing a globe image rotating in the middle of screen, and after some time some movement in command line console. You will be taken to root prompt finally, which is definitely a second most relieving moment of entire exercise, first definitely when you successfully reset the password. OK here we continue...

3. Run below commands one after other in root prompt:

# sbin/fsck -y
# /sbin/mount -wu /
# /sbin/SystemStarter

4. Here to begin the rock. Run below command:

# passwd
(This will prompt for new password twice. It's done now!)

5. Get the hell out of this black screen now:

# exit
(This will reboot our computer. Leave it alone to take you to the original beautiful desktop.)

Note: I do a lot of experiments on my items. Please do it on your own risk. Any query, please contact thru "Ping Me" from right sidebar.

Navigating SEO in the Age of AI: Strategies for Success

In recent years, the rapid advancement of Artificial Intelligence (AI) has significantly altered the landscape of search engine results page...