Reset SSH Password on iPhone or iPod Touch
In this article
To reset the SSH password on your iPhone or iPod Touch, you must first have SSH installed and be able to connect to the device (usually via a computer). The quickest way is to use a terminal app on your computer to log in as root and run the passwd command. If you forgot the current root password, you can reset it by restoring the device in recovery mode (this erases all data) or by using a tool like Cydia's "Mobile Terminal" if you still have access. Below are the exact steps.
What You'll Need
- Your iPhone or iPod Touch with SSH already installed (e.g., via Cydia or Sileo).
- A computer with a terminal (macOS Terminal, Windows Command Prompt, or Linux terminal).
- The IP address of your device (found in Wi-Fi settings).
- The current SSH password (default is often "alpine" for root, but it may have been changed).
- If you don't know the current password, you'll need a computer with iTunes or Finder (macOS Catalina or later) to restore the device.
Step-by-Step
- Ensure SSH is running. On your iPhone/iPod, open the Settings app, go to Wi-Fi, tap the info icon (i) next to your connected network, and note the IP address (e.g., 192.168.1.10). If SSH isn't already running, you may need to start it from a package like OpenSSH (usually installed by default if you have Cydia).
- Connect via SSH from your computer. Open a terminal (on Windows, you can use PowerShell or install PuTTY). Type:
ssh root@[IP address](replace with your device's IP). Press Enter. - Enter the current password. When prompted, type the current root password. If you've never changed it, the default is often
alpine. If that fails, try the mobile user's password (default is alsoalpine). If neither works, skip to the Troubleshooting section for a restore method. - Run the passwd command. Once logged in, type
passwdand press Enter. You'll be asked to enter a new password. Choose a strong one (mix of letters, numbers, symbols). Type it, press Enter, then type it again to confirm. - Change the mobile user's password (optional but recommended). Type
passwd mobileand repeat the process. This prevents unauthorized access via the mobile account. - Log out. Type
exitor press Ctrl+D to close the SSH session. - Test the new password. Reconnect via SSH using the new password to confirm it works.
Common Mistakes
- Typing the IP address incorrectly. Double-check the IP in Wi-Fi settings.
- Using the wrong username. The default SSH user is
root, notadminoruser. - Forgetting that the default password is
alpine(all lowercase). If you changed it before, you must use that old password. - Not having SSH installed. If you don't have OpenSSH, you can't connect via SSH. You'll need to install it first (via Cydia/Sileo) or restore.
- Changing the password but not the mobile user's password, leaving a security hole.
Tips
- Use a password manager to store your SSH password securely.
- Consider using SSH keys instead of passwords for more secure access (but that's a more advanced setup).
- If you're on a jailbroken device, be aware that restoring via iTunes will remove the jailbreak and all data. Back up important files first.
- Always change the default password immediately after installing SSH to prevent unauthorized access.
Troubleshooting
If you forgot the current SSH password:
- If you have another way to access the device (e.g., a terminal app on the device itself like Mobile Terminal), you can log in locally as root and run
passwd. But if you don't know the root password, you can't log in locally either. - The only reliable way to reset a forgotten root password is to restore the device. Connect to a computer, open iTunes (or Finder on macOS Catalina+), put the device in recovery mode (press and hold the Home button (iPhone 6s and earlier) or Side button (iPhone 7 and later) while connecting to the computer, then follow the on-screen prompts to restore). This erases all data and settings, including the jailbreak and SSH. After restore, you'll need to re-jailbreak and reinstall SSH if you want it again.
If SSH connection is refused or times out:
- Make sure your device and computer are on the same Wi-Fi network.
- Check that SSH is actually running. You can install a package like "OpenSSH" from Cydia/Sileo if it's missing.
- Try pinging the device's IP from your computer:
ping [IP]. If no reply, check firewalls or router settings.
If you get "Permission denied" after entering the password:
- You're likely using the wrong password. Try the default
alpinefor both root and mobile. If that fails, you must restore.
Frequently Asked Questions
What is the default SSH password on iPhone?
The default password for both root and mobile users is alpine (all lowercase). It's highly recommended to change it immediately after installing SSH.
Can I reset SSH password without restoring?
Yes, if you know the current password. If you forgot it, you cannot reset it without erasing the device via restore, unless you have another method of gaining root access (e.g., a local terminal app that is already logged in).
Does resetting SSH password delete my data?
No, using the passwd command only changes the password. However, restoring the device to reset a forgotten password will erase all data.
Why can't I connect via SSH even with the correct password?
Possible reasons: SSH not installed, firewall blocking port 22, device not on same network, or SSH service not running. Check these one by one.
Is it safe to use SSH on a jailbroken device?
SSH is safe if you change the default password and only connect on trusted networks. Leaving the default password makes your device vulnerable to attacks.
Can I change the SSH port to improve security?
Yes, you can edit the SSH configuration file (/etc/ssh/sshd_config) and change the port, but this is advanced and may break other services. It's not necessary if you use a strong password.