Mac OS X recover lost root password

Contributor Icon Contributed by macster Date Icon September 25, 2004  
Tag Icon Tagged: Apple Mac

For the sake of security, recommendations say to have unique, complex passwords. Most people have a hard time remembering these and will eventually forget one. Forgetting the root password on a Mac system can seem devastating, but this recipe will show an easy way to recover.


If you have the password to an account that is an administrator on the system, then it is easy to recover the password using the sudo command. Open a terminal window and type:

sudo passwd root

and you will be prompted for your password (the user account that you do remember). Then you will be prompted for the new root password twice. That’s it!

The sudo command is a wonderful way to control who can do what on a system. In this case, since the user account is considered an administrator, the sudo command allows you (after confirming that you are who you say you are with the user password) to run a command as if you were root. The command we are running is passwd root which is the command to change the password for the root user.

If you do not have an administrator password, either, you can still reset the root password. Boot the system from the Mac OS X installation CD and select the Reset password option from the installer screen and follow the directions.

Previous recipe | Next recipe |
 
  • miamiman
    Hello, I recently bought a apple g4 laptop , and do not have the password to unlock ....what can I do as I do not have the reinstall disc to boot from? Also, do i type in "sudo passwd root' or "passwd root" only? Thx very much. I enjoyed discovering this site...
  • potty
    Hey, I also got locked out of my computer several days ago. I tried several free software. It took me two days and got quite messy. Unfortunately none of them work for me. Finally I made it work with Password Genius. The good news is that it works. The bad news is it is not free.
    Check this out: http://www.password-genius.com
  • qmchenry
    Do you have the password to an account on the system that is an administrative account? Only those accounts can use sudo (which is quite the cool, recipe-worthy command when I or someone else has the time). Sudo is essentially a way to prevent users from having to become the root user to do root user activities. Many people tend to log into unix systems as root with all the gui weapons -- I mean tools -- at their disposal, ready to wipe out their system. It's a nasty habit, one which makes a unix system one step closer to a windows box. Speaking of boxes, I'll get off my soap one now..

    If you have an account that is privileged (can use sudo), and there can be several on a system, then you can login as that user and use the sudo passwd root command. The password it will ask you for is the current, privileged user's password. Then it will ask for the new root password twice and you should be set. If you do not have an administrative account, let me know.. there are other ways....

    Q
  • Jessica
    I think the best way for you is to reset your windows password. Password Genius can solve all your problems within a few minutes. Most importantly, No need to call a technician, no need to re-install anything.
    You can check this out:
    http://www.password-genius.com/how-to/how-to-re...
  • jeremy111
    We're talking about Macs here, you spam-bot.
  • check
    im having this problem...im stuck on a non-admin account and I lost my admin password...on top of that...my disc drive doesnt seem to work...and my os x disc will not boot from my external dvd drive....
    what can I do?
    thanks
  • qmchenry
    This worked for me on 10.3:

    Restart the system (Apple menu -> Restart)
    Hold down Command-S while restarting -> lots of white on black text
    From the command prompt issue these commands:

    mount -uw /
    /usr/libexec/register_mach_bootstrap_servers /etc/mach_init.d
    netinfod -s local
    SystemStarter
    passwd root



    I believe that in some other versions of OSX, the second and third steps are not required because SystemStarter configures networking in those versions. In 10.3, several services will not start without active networking including opendirectory which stores the passwords.

    If you get to the command prompt and run 'passwd root' and it sits for 10-15 seconds and then returns to a command prompt, this is indicative of a timeout waiting for connection to a service that is not running. If you didn't do all of the steps above, try them in that order and see if that helps.

    Q
  • check
    thank you for your help...going to try it now...but even if it doesnt work I appreciate it greatly!
  • check
    the SystemStartup seems to freeze the computer while searching for something called "ARDAgent.app"
    not sure what that's all about
  • qmchenry
    Sorry that didn't work.. what version of OS X are you running? There should be a way to prevent that service from starting. There may also be an easier way for your specific version.
  • cbk
    Same problem....stuck on a non-admin account, lost admin password....disc drive not working.......OS X will not boot from external dvd drive.....we are using Panther not 10.3 - will those instructions still work? Thanks.
  • asp
    How do I check which version of mac os I have? I am really new to mac sorry, I have the same problem. For me when I sent in my powerbook for repairs, it returned with a changed admin password.
  • Anonymous
    1. boot computer and hold the "apple" key and the "s" key.
    2. wait for terminal show
    3. release keys
    4. type without the quotes: "/sbin/mount -uaw"
    5. press enter
    6. type without the quotes: "rm /var/db/.applesetupdone
    7. press enter
    8. type without the quotes: "reboot"
    9. press enter

    this will let you create a new admin account when you reboot your computer.
  • emilymcg
    Thank You!!! You are our hero! This saved us such headaches! Our computer will not be a paperweight! Good luck to everyone!
  • Joel Garfield
    This was very helpful. Thank you. I forgot the password to my old iMac, lol. Thanks again.
  • davak
    I'm not an apple guy, but this seems like a great recipe!!!

    If you want to post it as a new recipe, I'll run it by our apple moderators and see if we can get you a fat amazon gift certificate reward!
  • Anonymous
    This does not "recover" anything; it would be more appropriate to say it "resets" or "changes" the password.
  • Anonymous
    i have ibook g4 bought it off of ebay the user is no longer a registered user so i cannot contact them to get the password so i bought a new os it is 10.2.4 when i start and try to reinstall it says i need the password i tried taylors way and qms way neither would work i know i done taylors way correct i know but i dont know about qms tell me if this is correct
    hold apple button by the spacebar and s upon boot
    type mount -uw / enter
    type /usr/libexec/register_mach_bootstrap_servers /etc/mach_init.d enter
    type netinfod -s local enter
    type SystemStarter enter
    type passwd root enter

    is all this correct


    im wanting to delete everything and install this new any way possible
    i appreciate any help i can get if there is anyone willing to talk me through this i might slide a little dough there way hit me up robertseber@yahoo.com any time thanks
  • Anonymous
    it currently has mac os x 10.4.6

    sorry i am new to a apple
  • Anonymous
    it currently has mac os x 10.4.6

    sorry i am new to a apple
  • Anonymous
    The command s/mount/rm/reboot sequence worked perfectly on osx 10.4.8

    OSX filenames are case sensitive, and the file on my machine was:
    /var/db/.AppleSetupDone
    :D
  • Anonymous
    Hmm i tried the "passwd root" command and at the end it came up with NetInfo write failed: Remote system error. Any ideas on what to do?
  • Anonymous
    <ul id="quote">
    taylorchase wrote:
    1. boot computer and hold the "apple" key and the "s" key.
    2. wait for terminal show
    3. release keys
    4. type without the quotes: "/sbin/mount -uaw"
    5. press enter
    6. type without the quotes: "rm /var/db/.applesetupdone
    7. press enter
    8. type without the quotes: "reboot"
    9. press enter

    this will let you create a new admin account when you reboot your computer.</ul>

    These are great instructions, thanks! This just worked for me!
  • jason myers
    this not only worked on the password problem but i never had to reload any programs thanks a million!!!!
  • Manda
    Will this work with filevault active?
  • rex2930
    I realy need your help i am getting frustrated badly step 1 to 5 works fine but when i try to do step 6, is says the following rm/var/db/ : no such fle or directory wth am i doing wrong Please write back ASAP
  • thomas bowen
    Daughter has only one account on Mac and doesn't remember her password. I can't load any new software. Any help? I tried the sh /etc/rc then passwd username it prompted me for a new password. I typed in the new password but nothing actually typed. It asked me to repeat it (even though nothing actually appeared) I typed in what I had the first time typed in reboot and after it rebooted, I went to daughters account tried to get in, but it said we didn't have the right password. A little help would be nice. Thanks
  • Nikki G.
    OK I have a MAC OS X
    Lost password
    NO administrator account
    Only One
    Can't find software
    HELP
  • kathy
    Wow thank you so very much! It worked the very first time!
  • les
    i lost my disc.s for back up and for got pass word to get in to my mac g4
  • jB
    Bad Title!
    In no way does this recover the lost password!
    It is useful for resetting the password.
    Important difference.
  • Ad
    Hi Can anybody help me? I couldnt remember my password to my ibook so i used this 1. boot computer and hold the "apple" key and the "s" key.
    2. wait for terminal show
    3. release keys
    4. type without the quotes: "/sbin/mount -uaw"
    5. press enter
    6. type without the quotes: "rm /var/db/.applesetupdone
    7. press enter
    8. type without the quotes: "reboot"
    9. press enter
    which worked great but when i got into my ibook everything that was on it had dissapered!! can anybody tell me how i can get the photos and music back that is on the system somewhere my hard drive is only showing 5 gig available and im about 9gig missing if somebody could tell me how to access these files i would me most gratefull Thanks
  • rex2930
    how do u no wth version of Mac Window base do u have i currenly los my passwork and my master password but tried everything wth u guys had down there Mac OS X 10.4 but do u do that if u cant get into your on Mac
  • thank you very much, your instructions worked a treat.

    i was trying to delete some files that were locked and hidden inside an app. v frustrating for a control freak like me. now very happy your simple instructions allowed me to change the root password, which i had forgotten. still wondering what it was... ???
  • Mohit
    Thanks a lot . i helps. I was able to change my password. I am really new to mac and linux, so dont know so many commands
  • eliza6226
    I have a Mac Mini with OSX 10.5.6.

    I have an admin password, and used your recipe to obtain another root password. However, when I try and log in the a new terminal window with the new root password it says "unknown command"

    What have I done incorrectly?
  • Matt
    If my MAC is stolen how does this prevent anyone with a leopard disk from recovering my password for my file vault account?
    ie: change root password, then change account password, then login, and steal company files?
  • Erkan
    Hi I can not acces command s . And forgot password and master and don.t have installation cd. Is there any diferent way ?
  • thomas
    i just baught this cpu and i dont have the cd but there is a password on it that i dont know what it is every time i try to download any thing it asks for it but i havent the foggiest. if any one knows how to get rid of this or knows any thing about these cpus please help im now ofically lost. please help me
  • I can not start my G4 lost the password OS
  • well this is quite a simple one and might not work for you, but if you have any other account on your mac( admin) then you can simply
    1. go to system preferences
    2. select the user from the left sidebar
    3.click reset password.
    4. it will ask you for a new password.
  • it is good to know that you can get advice, i recently lost my password so i will try this and see if it works
  • SK
    I want to reset password on my mac. Today morning it asked me to login with user name and password, it never asked me admin password. I entered the correct password but it is not working. I tried to reset the password and hint using OS X disk, but it still not accepting my new password. I can see the password hint changed, but whenever I try to do some administrative task, it will ask me admin password and reject it. Please help me to solve this issue. I can login to my account using OS X disk but when I will enter my admin password to do some administrative task it is rejecting my password.
  • carlos
    where do i type that? whats the sudo comand?
  • lewisj
    Hi everyone,

    I tried to reset password via....

    1. boot computer and hold the "apple" key and the "s" key.
    2. wait for terminal show
    3. release keys
    4. type without the quotes: "/sbin/mount -uaw"
    5. press enter
    6. type without the quotes: "rm /var/db/.applesetupdone
    7. press enter
    8. type without the quotes: "reboot"
    9. press enter


    But now it just comes up with a select language page and when I choose english it loads up the System Administrator account. I can not log in as anyone else even if I create new users. In this state I try to log out, shut down etc, but nothing happens. Does anyone know what has happened here. Help is so so appreciated.
  • George
    I need to reset my administrator password on my mac. I have followed instructions according to the apple website but it doesn't work. When I attempt to open the install disc on the computer it asks me for the password. Kinda defeats the purpose, I don't know the password. Is there anyway around this or am out of luck.

    Please help
  • grantrob
    I recently bought an iMac G3. Ido not know the password. I am using a windows keyboard. When I boot m mac the windows + s has no effect! If you can please help me that would be great.
  • drewgost
    After you type the above commands and reboot I notice that the white screen shows up for 30 seconds then boots into original user. I never see the prompt I just type the commands but never see any typing but it does reboot when i hit enter I am using an external screen.

    Am I supposed to enter a password when the white terminal screen shows up?

    Please help
  • williamsr
    i have a imac with 10.5.8. i just bought an old imac g3 with 10.3. i dont have the passwords for the g3. i have taken the hard drive out and connected it to my new imac. but i still can not change the passwords on the hard drive. is there a way to do this.
  • Mike
    Worked like a charm! Thanks!
  • Noxious_sully_dolor
    IT WORKED
    U THE MAN
  • robfluth
    I have downloaded windows password key 8.0. It is a very quick and useful utility for resetting passwords. It not only supports XP, 2000, and NT, I have personally tested it with Vista Home Premium and Ultimate. It works perfectly to reset any local user account to a blank password.
    Just an easy to use bootable CD/DVD . It can also be used on a USB Flash Drive. http://www.lostwindowspassword.com/
  • deer1
    hm...interesting...
  • zadova
    This one worked fine on a recent (Nov 09) iMac with MacOSX 10.6.2 of a friend who had forgotten his initial admin password account: Thanks "lewisj"

    1. boot computer and hold the "apple" key and the "s" key.
    2. wait for terminal show
    3. release keys
    4. type without the quotes: "/sbin/mount -uaw"
    5. press enter
    6. type without the quotes: "rm /var/db/.applesetupdone
    7. press enter
    8. type without the quotes: "reboot"
    9. press enter

    The computer reboots as if it was brand new and I could create a new admin account. The guy had only used it one day so nothing was lost when I erased the account with its lost password.
  • Nelly
    I have tried everything I have read on here but my admin password does not seem to be erased. Every time I go back, it still there and waiting for me to type it in but forgot the damn password.

    I do need serious help because I cannot install anything, And when I ran the disk, it deleted everything operating to an old system not updated. So no current flash or office working. :( Need serious help to unlock the admin password and get a new one.

    Some give me some better instructions. I have done all I read on here and some others from somewhere else successfully going through it but I still find the password hint waiting for me..
    Can anyone help please..
  • Sally
    Hi,Nelly. Don't worry, there are many people forget their admin password, and there is an easy solution for those who have been locked out by computer. For this solution, all you need is another computer that can link to Internet and then downloads Password Genius at http://www.password-genius.com .With Password Genius, you can create a reset CD which can be used to login windows without password. Then you can reset your password. Hope this can help you!
  • kered
    For some reason my Mac won't accept my password though I have not changed it. I have my original start up CD and have tried as per mac instructions to reset password + I have gone through the internet trying everything suggested with the same results; it keeps asking for the original password/the password I'm putting in is incorrect!
  • tab1ta
    Hi, my problem is that i cannot type any command while the installation DVD starts the installation up, so i cannot access neither the Utility or the Single user mode...
    Any Hints?
  • jwtpakistan
    hello

    i forgot my password , i musing mac os x 10.6
    and want to change my password but i forgot password .

    thanks
  • gregory12345
    hello i got a big problem i hope someone can help me..
    i bought i mac pro from someone i wanted to change the account that i did with no problem and then i wanted to change the login code. i did that by using the cd everthing worked fine but when i reboot my system i cant login anymore. my password is "wrong". i tried to restart by disc wont work. i tried to do it without cd with the cmd+s wont work either. any button when i reboot the system wont work. I really dont know what to do and i really hope someone could help me! because i just got mij mac and i dont want to trow my money away.

    thanks
  • Miasung
    Hi,
    I meet the same issue.
    I tried several free software. It took me two days and got quite messy. unfortunately none of them work for me.
    finally I made it work withpassword genius. the good news is it works. the bad one is it is not free.
    Check this out: http://www.password-genius.com/how-to/how-to-re...
    Hope this can help you!
    Best wishes!
    Mia.
  • za_tinker

    I ever used a windows password recovery software to reset windows administrator password to blank,it need not to reinstall or reformat the windows os, with no data lose,the tool is "Any Windows Password Recovery 3.0 ",its easier,you could have a try.


blog comments powered by Disqus