[How To] Reset Your iDevice Root SSH Password
It happens to the best of us. You zealously jailbreak your iP(hone)(ad)(od Touch) and dutifully change your root password from the well-known default, "alpine," so as to prevent grief and rickrolls in the future. For good measure, you change your mobile password, too.
Then one day, you want to SSH or SFTP into your device. Your fingers skim the keyboard lightly as you enter your IP address and root password while humming a cheerful tune, but when you hit "Enter," the unthinkable happens — YOU GET AN ERROR.
This happens several times before you realize it's because you've forgotten your root password, but because you don't know the password, you can't reset it to "alpine" via MobileTerminal.
Suddenly, rickrolls don't look so bad.
Never fear, though — there's a very easy fix! On your device, pop open Cydia and search for the "iFile" app. Download it to your device (there's a free trial) and open it up.
Now, in the upper left hand corner you'll see a "back"-type button. Keep tapping it until it disappears, and the title of the page is a / (slash mark). This means you're at the root directory. Be careful not to mess anything up here; the consequences could be severe. ;)
Navigate to /private/etc/. Scroll past the directories at the top and you'll see a bunch of files with no extension. Tap the one called "master.passwd" and choose "Text Viewer" to open it. Next, hit the "Edit" button in the upper left hand corner. Scroll to the line that says
Of course, RANDOMCHARACTERSHERE is going to have actual characters, it differs depending on your password. Whatever it is, replace it with
And you're good to go! You can now log in as root again with "alpine" (but make sure to change your pass again)!
In case you need to reset your mobile password (if you don't know what this means, disregard it), just find the line right below the "root" line that reads
Replace it with
Now your mobile password is also set to "alpine"!