Page 1 of 4 1234 LastLast
Results 1 to 10 of 33
Like Tree1Likes
Discuss [Tutorial] Change iphone root password if you've forgotten it. at the General - Hackint0sh.org; Well I forgot my root password and didn't find any info as to how to ...
  1. #1
    Newbie Array

    Join Date
    Jul 2009
    Posts
    1
    Post Thanks / Like
    Downloads
    0
    Uploads
    0
    Rep Power
    0

    Default [Tutorial] Change iphone root password if you've forgotten it.

    Well I forgot my root password and didn't find any info as to how to recover it. Turns out it's easy peasy. So I thought I'd make that info for the people who did the same stupid thing as me and a searching the net for an answer. Here it is (the instructions are very simplified, anyone should be able to do this).

    tested on jailbroken 2.2.1 3G

    So you forgot the root or mobile password to your jailbroken iphone and can't ssh into it any more. Well it sucks to be you, or at least it really would if you couldn't read this. So follow the instructions below to set a new password.

    A note: apparently the 'passwd' utility just screws everything up, so never use that in-case that's still true.

    Just so you know what we're doing, our objective is to get root write control to the file system so you can change the password in /etc/master.passwd . This should be simple as all apps run as root (or so I hurd). We do this by installing iFile, copying

    Note that everything is (obviously) 'minus quotes'. That means if I say type "echo hello" don't type those double quotes.

    Well here's the instructions:
    1. Open up cydia
    2. Wait for it to do that "Loading data" crap and hope that it's loading something more than 'home' because you're just going to go straight to search.
    3. Search for a package called iFile.
    4. Install iFile.
    5. Once iFile is installed close cydia and open up iFile.
    iFile is a program that will let you browse, open, and maipulate files. This includes moving them. It dose this with root powers.
    6. In iFile browse to the /etc directory (top left a few times, then find 'etc' and tap that).
    7. Once in /etc/ scroll down to a file called 'master.passwd'.
    8. Press the edit button (top right).
    9. Tap on the letters 'master.passwd' that indicate the file 'master.passwd'. This should put a little red dot to the left of it.
    10. Tap the icon/button thing in the bottom right (looks like an arrorw speeding out of a picure frame (or one of those pictures you get after roller coasters, upside down).
    11. Select 'copy'.
    12. Tap 'Done' (top left, where edit was).
    13. Tap the home icon/button thing (bottom, second from the right, looks like a house).
    Now you're in '/var/mobile' if I am correct.
    14. Tap edit again
    15. Tap that bottom right copy/cut/paste arrow-in-a-picture-frame button thing that you tapped before (I'd tap that).
    16. Tap paste.
    17. Tap the blue circle to the right of 'master.passwd'.
    18. See where is says 'Ownership', followed by these two lines:
    Owner root >
    Group wheel >
    tab on owner, change it to Mobile. Then do the same for Group. So you have:
    Owner mobile >
    Group mobile >
    19. Close iFile.
    20. Go to terminal (I presume you already have it installed as you use openSSH, is that a good presumption? Dose everyone have Terminal? Well if you don't: install Terminal just how you did with iFile (through cydia)).
    19. In the terminal (type pwd and make sure you're in /var/mobile, if it dosen't say '/var/mobile', type "cd /var/mobile" )
    21. At the terminal type: "grep ^root master.passwd" you should see something like:
    root:UlGq3RrXWDrOc:0:0::0:0:System Administrator:/var/root:/bin/sh
    22. Take note of the string or random-looking letters and numbers between the first two colons (in the case above 'UlGq3RrXWDrOc') that is the password 'hash', an encrypted form of you password that cannot be unencrypted.
    23. Next you want to generate a new password hash. You can do this with the perl function 'crypt'. If you've no idea what that is head over to Test crypt online . At that website you see a large text area with $str above it, and a one-line text input with $salt above it. $salt can be any two characters, I chose Ul as that was what was there before and that makes me feel safe for some reason. In $str will be where you type your new password, go ahead and do that, and salt. Next click run.
    24. You will get a result like what you previous hash was (note if you've done this a different way and get something that looks like: $1$Rt79jmd6$526Di9l3ra//YfQ7BvD./1 that's bad, that's why you're going wrong. It should be shorter and without dollar signs).
    25. First backup the master.passwd you have in case do make a boo boo and have to start over. Do this by typing "cp master.passwd master.passwd.bak".
    26. Now you're going to edit the copy of master.passwd you have to replace the old hash with the new hash using a line similar to this: "sed -i s/root:OLD_HASH/root:NEW_HASH/g" replacing 'OLD_HASH' AND 'NEW_HASH' with you old hash and your new hash. For example:
    My old password was 'miakirshnerishot' and I want to change it to 'miakirshnerisREALLYhot!1!'.
    Password , , , , , hash:
    miakirshnerishot UlD3amElwHEpc
    miaisREALLYhot UlRsc4Sqd.Ayg
    Then at the terminal I'd be typing (stuff I type has a '$' before it:
    $grep ^root master.passwd
    root:UlD3amElwHEpc:0:0::0:0:System Administrator:/var/root:/bin/sh
    $sed -i s/root:UlD3amElwHEpc/root:UlRsc4Sqd.Ayg/g

    (please not that it's really easy to mistype something and screw it up, triple check both hashes you type in before you press enter.
    26. If you want you same for mobile (the user), in which case you'll be replacing 'root' with 'mobile', in the above example there are 3 'root's that you need to replace.
    27. Now that you've edited master.passwd you must replace the old one with the edited version. So close Terminal and go into iFile, make sure you're in you home directory.
    28. In iFile tap edit.
    29. Tap the letters 'master.passwd' to make that red dot appear.
    30. Tap the arrow-picture-frame bottom/icon copy/cut/paste thing.
    31. Tap Copy.
    32. Tap Done.
    33. Navigate yourself to /etc
    34. Tap edit again.
    35. Tap the copy/cut/paste arrow-picture-frame thing again.
    36. Tap paste.
    37. Choose to overwrite (don't worry you made that backup remember).
    38. Tap the blue dot to the left of to master.passwd.
    39. Under 'Ownership' change the Owner back to root, and the Group back to wheel.
    40. Go back into Terminal and check your root password by typing "su -" and entering your root password. Test the mobile password with ssh if you changed it.
    41. Now you can delete the master.passwd and master.passwd.bak in your home directory. Do this by typing "rm ~/master.passwd*".

    Congratulations you successfully rooted your iphone and changed the password (wasn't exactly hard was it).




  2. #2
    Speedy Administrator Array n350z's Avatar

    Join Date
    Nov 2007
    Location
    United Kingdom
    Posts
    3,021
    Post Thanks / Like
    Downloads
    0
    Uploads
    0
    Rep Power
    10

    Default

    Thread Moved from waiting approval in the "Genius Bar - HowTos, Guides and Tutorials" to General section for now.
    -
    Read the stickies and search the forum before posting!
    Did we solve your problem? +1 us above
    If you want to become a Hackint0sh supporter click here
    ----------
    Follow Hackint0sh Follow Me

  3. #3
    Newbie Array

    Join Date
    Sep 2009
    Posts
    2
    Post Thanks / Like
    Downloads
    0
    Uploads
    0
    Rep Power
    0

    Default

    I get "sed: no input files"

    (on a side note, the terminal REALLY needs copy & paste for stuff like this)

  4. #4
    Newbie Array

    Join Date
    Sep 2009
    Posts
    2
    Post Thanks / Like
    Downloads
    0
    Uploads
    0
    Rep Power
    0

    Default

    Nevermind, I figured out the problem: at step 26, where it says
    Code:
    sed -i s/root:UlD3amElwHEpc/root:UlRsc4Sqd.Ayg/g
    it should be
    Code:
    sed -i s/root:UlD3amElwHEpc/root:UlRsc4Sqd.Ayg/g master.passwd

  5. #5
    Senior Professional Array

    Join Date
    Jul 2009
    Posts
    177
    Post Thanks / Like
    Downloads
    0
    Uploads
    0
    Rep Power
    13

    Default

    This has been a great post. I just can't even thank you for that. Thanks will be very small for that. I was looking for this kind of solution and you provided all the steps in details. Keep up the good work.


  6. #6
    jck
    jck is offline
    Newbie Array

    Join Date
    Oct 2009
    Posts
    1
    Post Thanks / Like
    Downloads
    0
    Uploads
    0
    Rep Power
    0

    Default password hashes

    Thanks for the reference to iFile.

    To make things easier, you can use sed to set your new password to null; when you 'su -' to root, just hit "enter", and then use the passwd command to set your new password.

    More specifically, use sed -i /root:xxxxxxx/root:/g

  7. #7
    Newbie Array

    Join Date
    Nov 2009
    Posts
    1
    Post Thanks / Like
    Downloads
    0
    Uploads
    0
    Rep Power
    0

    Default

    your guide has been very easy to follow and worked well, that is until step 21. It says "permission denied" after i typed "grep ^root master.passwd".
    Any idea why am i getting this? thanks in advance

  8. #8
    az_
    az_ is offline
    Newbie Array

    Join Date
    Nov 2009
    Posts
    1
    Post Thanks / Like
    Downloads
    0
    Uploads
    0
    Rep Power
    0

    Default

    I have got up to 23, I have done the "grep ^root master.passwd" and got the root:/..........:0:0::0 etc, now I am struggling

    Sorry I need a bit of help in idiot mode please!!

  9. #9
    Board Hero Array

    Join Date
    Dec 2007
    Posts
    1,044
    Post Thanks / Like
    Downloads
    0
    Uploads
    0
    Rep Power
    74

    Default

    Wouldn't it be easier to modify /etc/master.passwd directly with iFile's edit functions, or copy it over to your computer using iPhoneBrowser and make the changes there? As jck above says, the only thing you need to do is remove a few characters, and then you can set a new password from the terminal/SSH client.
    iPhone 3GS / 3.1.2 JB (PwnageTool) / 04.26.08 carrier-locked, Carrier Logo Fixer / Cydia / 1000 posts on Hackint0sh

    Installing Cydia programs on a phone that has no internet connection: read this.

    Editing binary .plist, .strings, .nib and .xib files:
    * on your computer: Windows tool / conversion website.
    * on your iPhone: convert those files in a terminal with plutil (installed with Erica Utilities) or edit them with iFile (Cydia links).

  10. #10
    Newbie Array

    Join Date
    Nov 2009
    Posts
    1
    Post Thanks / Like
    Downloads
    0
    Uploads
    0
    Rep Power
    0

    Default legend

    i signed up just so i could say this, works on 3gs with latest software. dietcoke you are a frikken genius xox
    p.s. after you go to crypt and do that you can just use ifile to edit you're copy of master.passwd (you'll see your old password hash there) and just change that to your new on. then copy, paste, overwrite your old one. But it all works and i am ever so thankful for this. cheers
    Last edited by Krisz0r; 11-26-2009 at 10:19 AM.


 

 
Page 1 of 4 1234 LastLast

Similar Threads

  1. Forgotten iPhone password (not the root pass)
    By jms2007 in forum General
    Replies: 19
    Last Post: 12-31-2007, 03:38 PM
  2. Replies: 0
    Last Post: 12-31-2007, 12:51 AM
  3. How to change the root password?
    By chrome01 in forum General
    Replies: 11
    Last Post: 09-19-2007, 08:04 PM
  4. can´t change the root password
    By pendalf in forum General
    Replies: 6
    Last Post: 08-15-2007, 10:53 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Powered by vBulletin®
Copyright © 2014 vBulletin Solutions, Inc. All rights reserved.
Search Engine Friendly URLs by vBSEO
(c) 2006-2012 Hackint0sh.org
All times are GMT +2. The time now is 09:35 AM.
twitter, follow us!