Sunday, September 6, 2009

How to change your iPhone SSH password after you've lost the password

This guide is for people who have changed the default root password from alpine to something else. And unfortunately, have forgotten to write down the password and now they can't ssh anymore into the device.

I thought I would make this contribution to the web because all the past guides seem to refer to this app called iCommander, which doesn't seem to be available on iPhone firmware 3.0. So without further ado:

What you'll need it is a Windows machine. You will want to google an application called iPhoneBrowser. It lets you transfer files from your iphone without ssh through the USB cable. On a mac, maybe a similar application is available that is able to accomplish the same thing. You will need iTunes installed, or the iPhoneBrowser will not start correctly.

on iPhoneBrowser, connect your iPhone, go to /private/etc directory

download the file master.password to your desktop. Open this file with notepad. be careful not to touch anything in here that is not necessary.

You will find a string that looks similar to this:

root:/myoldpasswordhash:1:2::3:4:System Administrator:/var/root:/bin/sh

replace the line with

root:/smx7MYTQIi2M:0:0::0:0:System Administrator:/var/root:/bin/sh

Save the file, and overwrite it on your iPhone with iPhoneBrowser. Now you can ssh in your iphone again with the password of alpine, and the username of root.

One last tip, change your password again using a ssh client like putty.exe by logging in and running the passwd command. This time, write this new password down. :)

1 comment:

  1. hey there Michael, i did exactly as you said to the letter and it doesnt work. i have an iPod touch 2g running 3.1.2 firmware and im running it on SSH and WinScp. both are the most recent versions (just to be clear).

    after i do what you posted, and i try to get SSH in through WinScp, it says "access denied" every time. and when i reboot, it stays at the apple symbol and then after a few minutes, the respring spinning asterix shows up halfway down the apple and then keeps spinning indefinitely.

    i keep having to put it into recovery mode and restore every time and retry different techniques to no avail.

    can you help me out? maybe send me a copy of your master.passwd file?

    any help you could prvide would be much appreciated.

    thanks so much.

    arishafner@yahoo.com

    ReplyDelete