Changing iPhone’s default password

iphone_pirate_21

This is a little post to show you how to reset your default root password after jailbreaking your iPhone/iTouch/iPad !

(This works for any iOS jailbroken device on any iOS version)

There are two ways to do this, first way is to do it via SSH, the second way is via mobile terminal.app

1st method:

  1. You need to have OpenSSH installed on your device, to do this, just install the package “openssh” from Cydia
  2. Get your device’s IP address (Settings->WiFi) then tap on the blue arrow next to your WiFi connection and get your IP
  3. Connect to your device via SSH using any computer in your network, open up your terminal (cmd) and type the following
    
    ssh root@192.168.1.2
    

    If this is the first time you connect to your device, you will see the following message:

    The authenticity of host '192.168.1.2 (192.168.1.2)' can't be established.
    RSA key fingerprint is xx:xx:xx:xx:xx:xx:xx:xx:xx:xx
    Are you sure you want to continue connecting (yes/no)? yes
    

    Just type “yes” and hit enter

    
    Warning: Permanently added '192.168.1.2' (RSA) to the list of known hosts.
    

    You will next be asked to enter your password, the default root’s password is “alpine”
    write alpine and hit enter

    
    root@192.168.1.2's password:
    

    You will be then logged in to your device !, you shall see something similar to this:

    
    mostafa-bergs-iPhone-4G:~ root#
    

    Now you should change your password by typing in the command “passwd”

    
    passwd
    

    You will then be asked to type the new password, do that twice (make sure you don’t forget/loose the password)

    
    Changing password for root.
    New password:
    Retype new password:
    

Congratulations!, You’re now safe from attacks.

2nd method:

Assuming that you can’t use SSH, so we’ll use the terminal on your phone directly !

  1. Install terminal.app (if you don’t already have it) by searching for “MobileTerminal” in Cydia
  2. Depending on your terminal, you can be logged in as a different use (“mobile”, “root”, etc…)
    To know your current user, type in:
    whoami
    if it says “root” then you’re ready to go to step 5 , if it says anything else, proceed to step 3 !
  3. Switch the current user to “root” by typing “su” or “su root”
  4. The terminal will ask you for a password, which will be “alpine”, type it and hit enter !
  5. Now it’s time to change your password, type in the command “passwd”
    passwd
  6. The terminal will show something similar to this:

    Changing password for root.
    New password:
  7. Type in your new password twice and you’re done !

Congrats again !, you’ve done it.

 

Changing your root password is a must, anyone in your network can access your iDevice and control everything on your gadget if you’re not secured !, after following this little tutorial you’ll be really safe to go and play outside.

4 comments

  1. shelltops   •  

    isn’t there any way to change alpine without having to do it via mobileterminal?
    it seems one has to go via that non-updated program whether one accesses the phone via ssh or terminal.
    this week, i’ve jailbroken 4x and every time, it’s mobileterminal that crashes upon launch, prompting me to install an old debian file (MobileTerminal_520-1_iphoneos-arm.deb) in order to get mobileterminal to work
    then, after installing it, the phone starts crashing/resetting springboard/booting into safemode, etc
    i’ve been jailbreaking all week, and the same exact problem always points to when i get mobileterminal to work, via this …-arm.deb file (which is necessary to install to get mobileterminal to work)
    my only option at this point is to either not jailbreak, or turn off wifi whenever i leave my home network
    i’d appreciate any suggestions you might have
    thanks!
    shelltops

    • Mostafaberg   •     Author

      Hey there !

      Well , there’s a simple solution, you don’t need the MobileTerminal, you can just login via SSH !

      Another thing, You can always turn off the SSH server using the SSH SBSettings toggle !

      The SSH server runs on 3G too, so even if you turned off your wifi, you can access your iPhone/iPad from the internet !

      I prefer to keep the SSH server on so I can get into it anytime i need (download files or wipe the phone if it gets stolen, or just simply find where the phone is via GPS, but that’s a more advanced topic)

      Thanks for your interest, if you have other questions let me know :)

  2. Ankit   •  

    Hi,

    I have a query , i have iPhone4 , i have already jailbreaked it,but didnt change the root pwd, now it has been disabled and asking for “Enter the Passcode” which i dont remember. I dont have ssh or mobile terminal installed in it. I am unable to restore using iTunes as well. Cellular network is also lost ….What should I do? Please Help….!!!!

    • Berg   •     Author

      Hey Ankit!,
      Can you please clarify what do you mean by “disabled” ? if your forgot your passocde the best way to restore your phone is to do it through iTunes, but you have to be in DFU mode or restore mode to be able to restore it to the original FW.
      what iOS version are you on too ?

Leave a Reply