How to change default SSH password for Jailbreak iPhone iPad iPod AppleTV – Apple – Tech Guides & Tips

We should all make a habit of changing the default passwords for the iPhone ‘s two primary admin accounts (usernames mobile and root) “ as once somebody gains root level access to an iPhone, it will be disastrous. This can be done via different methods:

1) On the iPhone:

The app to use on the iPhone is called MobileTerminal and it ‘s available for free in the Cydia store.

Once you have MobileTerminal installed, launch it and you should see a prompt saying this or similar:

iPhoneName: ~ Mobile$

  • At that prompt, type: passwd
  • You ‘ll be prompted for the ‘old ‘ (current) password for the mobile user.  Enter this as the old password: alpine
  • You ‘ll then be prompted to enter the new password “ so just type in your desired new password.  Use good password principles if possible (long and stong).  You will not see characters appearing on the screen as you type “ that ‘s normal, not a concern.
  • You ‘ll then be prompted to re-enter the new password.  Do that.
  • You should then be returned to the Mobile$ prompt that you started on when opening the MobileTerminal app.  There ‘s no success message to say the password was changed “ but if you ‘re returned to the prompt and do not get an error, the change was successful.  And you ‘re done with change for the mobile account.
  • The second primary admin account for the iPhone is called root “ so now you need to change that as well.
  • Type this to switch to the root user: login root
  • You ‘ll be prompted for the root user ‘s current password.  Enter this: alpine
  • Type this to start the password change routine again: passwd
  • Enter the old password for root (it is ‘alpine ‘, same as for the mobile user) and enter your desired new password twice, just as you did for the mobile account


2) On a Mac:

  • Find your iPhone ‘s IP address so that you know where you need to connect to.  To do this, go to the Settings app > WiFi > tap on the blue arrow to the right-hand side of the WiFi network you ‘re currently on (the one with a check next to it) > make a note of the IP Address entry listed there.
  • On many home WiFi networks the address will be something like 192.168.1.x “ so we ‘ll use that in the command instructions below “ remember to use your own IP address when doing this though.
  • Use the Terminal app or your favorite replacement for it (I use iTerm) and open a new window
  • Type this to connect as root to your iPhone: ssh root@192.168.1.x
  • You ‘ll be prompted for the root user ‘s current password.  Enter this: alpine
  • Type this to start on changing the password for the root user: passwd
  • Type the old password (alpine) and new password (twice) as per the instructions above for the iPhone.
  • Once you have changed the root user ‘s password, type this to switch to the mobile user:login mobile
  • Type this to start the password change for this user: passwd
  • Type the old password (alpine) and new password (twice) as per the instructions above for the iPhone.
  • Type this to end your remote session with the iPhone: exit

3) On a Windows PC


  • Find your iPhone ‘s IP address so that you know where you need to connect to.  To do this, go to the Settings app > WiFi > tap on the blue arrow to the right-hand side of the WiFi network you ‘re currently on (the one with a check next to it) > make a note of the IP Address entry listed there.
  • On many home WiFi networks the address will be something like 192.168.1.x “ so we ‘ll use that in the command instructions below “ remember to use your own IP address when doing this though.
  • Use Putty (free to download on the web) or your preferred app to make an ssh connection to the iPhone
  • Use 192.168.1.x (your iPhone ‘s IP address) as the host name or server name to connect to.  Choose ssh as the connection method, SFTP as the protocol, and 22 as the port number.
  • Use the username root to connect with and alpine as its password
  • When you have connected and have a terminal window open type this to start your password change for the root user: passwd
  • Type the old password (alpine) and new password (twice) as per the instructions above for the iPhone.
  • Once you have changed the root user ‘s password, type this to switch to the mobile user: login mobile
  • Type this to start the password change for this user: passwd
  • Type the old password (alpine) and new password (twice) as per the instructions above for the iPhone.
  • Type this to end your remote session with the iPhone: exit


Things To Try If You Cannot Connect To Your iPhone Via SSH:

  • If you get a timeout error, try increasing the timeout setting
  • Make sure SSH is turned on, on the iPhone – Generally the easiest way to do this is to use an app like SB Settings that gives you a GUI interface to toggle the service on and off with.
  • Make sure WiFi is turned on, on the iPhone “ again, via SB Settings or the iPhone ‘s built-in Settings applet.
  • Check that you are specifying the right port in your desktop SSH app (e.g. WinSCP on Windows or Cyberduck on Mac).  The port needs to be 22.
  • Make sure you are entering the correct “ and *current* “ IP address for the iPhone.  If your iPhone gets a DHCP (dynamically configured) IP address from your router (as most do), then its address can and will change over time.  So its IP address today may be different to the one it had last week when you last successfully connected.  To check this go to Settings > WiFi “ and tap on the blue arrow next to your active WiFi connection “ the screen that takes you to will display the iPhone ‘s current IP address.
  • Verify that the iPhone has a *valid* IP address.  When you are checking the address per the above point, if you see an address that starts with 169.254.x then the iPhone is not getting a usable IP address “ and you need to troubleshoot that issue first.
  • Remember that the iPhone and the PC you ‘re tying to connect from must be on the sameWiFi network.  One of the easiest ways to tell this is to see if their IP addresses look similar.  For instance, many default home WiFi networks will have IP addresses that start with 192.168.x.
  • Check that you do not have any antivirus, firewall, or security software on your PC that may be blocking your outbound SSH connection.  One of the easiest ways to quickly rule this out (or pin the blame on it) is to shut down any and all of those services on your PC temporarily and try connecting. If it still fails, you know those services are not to blame.
  • Password check “ you need to be using the correct username and password for connection to the iPhone.  If you have never changed these (which the vast majority of iPhone users have not “ and you would know if you did) then the most likely defaults are username ‘root ‘ and password either ‘alpine ‘ or ‘dottie ‘.  Please note “ you do not type the ‘ ‘ inverted commas around the username or password.
  • The iPhone cannot be in ‘sleep mode ‘ when you are trying to connect.  You may just want to change your Auto-Lock setting to ‘Never ‘ just for while you are connecting “ to avoid this issue.
  • Make sure you are using the correct protocol setting in your desktop SSH app.  This varies according to which client app you are using.  WinSCP uses SCP, for example.

Backup and remove existing keys

If you have an existing keypair you wish to use, you can skip this step.

Unless this is your first time setting up ssh or git on your computer, you should double check that keys do not already exist. If they do you can either use the existing key(s) or remove them. In either case, you should make a backup of the keys.

First check to see if a ssh key directory exists.

$ cd ~/.ssh

If you get a “No such file or directory” error, you can skip to “Generating a key”.

$ ls config  id_rsa  id_rsa.pub  known_hosts $ mkdir key_backup $ cp id_rsa* key_backup $ rm id_rsa*

Here we have an existing keypair, id_rsa and id_rsa.pub, which we’ve copied into ~/.ssh/key_backup before removing. By default, ssh will use keys in ~/.ssh that are named id_rsaid_dsa or identity.








Share this article on:
Facebooktwittergoogle_plusredditpinterestlinkedinmail
Follow us on:
Facebooktwitterinstagram

Facebook comments:

Leave a Reply

Your email address will not be published. Required fields are marked *