Home User CP Donate Chat Register Today!  
  Get New posts Faq / Help?
   


Go Back   Hackint0sh > Projects and Hacks > iPhone > General > General

Reply
 
LinkBack (6) Thread Tools Display Modes
  6 links from elsewhere to this Post. Click to view. #1 (permalink)  
Old 07-28-2009, 09:39 PM
DietCoke
Status: Offline
Trial Member
 
Join Date: Jul 2009
Posts: 1
Rep Power: 0
DietCoke is on a distinguished road
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

Quote:
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).

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #2 (permalink)  
Old 07-28-2009, 10:36 PM
n350z's Avatar
n350z
Status: Offline
Speedy Moderator
 
Join Date: Nov 2007
Location: United Kingdom
Posts: 2,908
Rep Power: 171
n350z is a glorious beacon of lightn350z is a glorious beacon of lightn350z is a glorious beacon of lightn350z is a glorious beacon of lightn350z is a glorious beacon of light
Send a message via MSN to n350z
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!
If you want to become a Hackint0sh supporter click here
----------
Follow Hackint0sh Follow Me
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3 (permalink)  
Old 09-14-2009, 07:00 AM
dysfunction
Status: Offline
Trial Member
 
Join Date: Sep 2009
Posts: 2
Rep Power: 0
dysfunction is on a distinguished road
Default

I get "sed: no input files"

(on a side note, the terminal REALLY needs copy & paste for stuff like this)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Sponsored links Remove advertisements
Advertisement
Advertisement

  #4 (permalink)  
Old 09-21-2009, 07:56 AM
dysfunction
Status: Offline
Trial Member
 
Join Date: Sep 2009
Posts: 2
Rep Power: 0
dysfunction is on a distinguished road
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5 (permalink)  
Old 09-27-2009, 05:54 PM
garykirsten63
Status: Offline
Senior Member
 
Join Date: Jul 2009
Posts: 177
Rep Power: 10
garykirsten63 is on a distinguished road
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.
__________________
Get cool iPhone apps
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #6 (permalink)  
Old 10-04-2009, 06:04 AM
jck
Status: Offline
Trial Member
 
Join Date: Oct 2009
Posts: 1
Rep Power: 0
jck is on a distinguished road
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Remove advertisements
Advertisement
Advertisement Sponsored links

  #7 (permalink)  
Old 11-23-2009, 02:47 PM
anasztasia
Status: Offline
Trial Member
 
Join Date: Nov 2009
Posts: 1
Rep Power: 0
anasztasia is on a distinguished road
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #8 (permalink)  
Old 11-23-2009, 05:55 PM
az_
Status: Offline
Trial Member
 
Join Date: Nov 2009
Posts: 1
Rep Power: 0
az_ is on a distinguished road
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!!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #9 (permalink)  
Old 11-24-2009, 05:43 PM
Jim Danner
Status: Offline
Respected Member
 
Join Date: Dec 2007
Posts: 1,044
Rep Power: 70
Jim Danner is a jewel in the roughJim Danner is a jewel in the roughJim Danner is a jewel in the roughJim Danner is a jewel in the rough
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).
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Sponsored links Remove advertisements
Advertisement
Advertisement

  #10 (permalink)  
Old 11-26-2009, 11:17 AM
Krisz0r
Status: Offline
Trial Member
 
Join Date: Nov 2009
Posts: 1
Rep Power: 0
Krisz0r is on a distinguished road
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 11:19 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Bookmarks

Tags
change, forgot, forgot password, iphone, password

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


LinkBacks (?)
LinkBack to this Thread: http://www.hackint0sh.org/f127/79608.htm
Posted By For Type Date
problem z has?em root • OS 3.x • forum.myiPhone.com.pl • Forum iPhone, iPhone 3G & iPhone 3GS This thread Refback 04-12-2010 11:34 PM
WinSCP - Discussion Pagina 11 - iPhone Forum - alles over de Apple iPhone, iPhone 3G en iPhone 3GS This thread Refback 04-12-2010 05:36 PM
WinSCP - Discussion Pagina 12 - iPhone Forum - alles over de Apple iPhone, iPhone 3G en iPhone 3GS This thread Refback 04-09-2010 09:58 PM
Google ·­Òë This thread Refback 04-08-2010 05:17 AM
RentAndInterest comments on Can't SSH to my !@#$ iPhone! I've asked all over, reddit, you're my last hope! I'm about to wipe and sell this silly thing. Please help This thread Refback 02-25-2010 05:05 AM
CydiaRepo.pl • Zobacz wÄ…tek - Jak odzyskać/zmienić haslo root! This thread Refback 02-21-2010 10:09 PM

Similar Threads
Thread Thread Starter Forum Replies Last Post
Official, Consolidated iPhone Hack Unlock Thread freudling General 9 10-31-2008 10:28 AM
[Installer] v3.1 (Nullriver) always crashing, why? strange CrashReport! automatix1 Free Toolchain Software 11 05-11-2008 04:00 PM
[1.1.3 OTB 16GB iphone - Using ziphone] My notes after JB+ACT+UNLOCK dtube Older Software Unlock Solution 0 02-12-2008 06:36 PM
Forgotten iPhone password (not the root pass) jms2007 General 19 12-31-2007 04:38 PM



All times are GMT +2. The time now is 06:26 AM.



Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.2 Ad Management by RedTyger
follow us on Twitter!

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448