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.
[Plain] view plaincopy
/Sbin/fsck-fy
Enter the command so that you have the permission to change the system configuration.
[HTML] view plaincopy
/Sbin/Mount-UW/
Finally, according to the command
[HTML] view plaincopy
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