From: http://osxdaily.com/2011/04/25/change-admin-password-mac/
Since air is not used for a long time, the previous root password is forgotten, and many commands cannot be executed, so I found this solution (I successfully tested it in Mac OS X 10.6.8 !), Let's share it with you.
- Boot, and quickly press command + S to enter the command line mode
- Enter the command (sometimes the command path may be different. Refer to the two lines on the screen), check the system error and fix it.
/Sbin/fsck-fy
- Enter the command so that you have the permission to change the system configuration.
/Sbin/Mount-UW/
- Finally, according to the command
Passwd Root
To change the password!
Then, press the reboot command to restart the machine!
The original text is as follows:
Change an admin password in Mac OS X Single User Mode
This is a multistep process but it's easy to follow:
- first you need to enter single user mode. reboot the Mac and hold down Command + S at boot to enter into the command line.
- you'll see a note where Mac OS X tells you that you need to run two commands in order to make filesystem changes, this is necessary so let's handle that first
- the First Command checks the Mac OS X filesystem for errors and fixes them, it can take a few minutes to run:
fsck-fy
- the next command mounts the root Mac OS X drive as Writable, allowing you to make changes to the filesystem:
Mount-UW/
- after the filesystem is mounted, You can reset any users password using the following command:
passwd username
- you'll need to enter the new password twice to reset and confirm the changes