SSH and Terminal Survival Guide for iPhone and iPod touch How to control your iPhone or iPod touch with UNIX shell commands The n00b way NOTE: for the sake of clarity, the terms "iPhone", "iPod touch", and "device", are used interchangeably in this guide, and can refer either to an iPhone or to an iPod touch. Commands are the same for both devices. Initial Setup For starters, you need to jailbreak your device. How to achieve this will not be covered here. There are a multitude of guides on this site and elsewhere, designed to help you in this regard. Once your device is jailbroken, launch Cydia, a new app on your home screen. This is the app that allows you to mod your device in any way you see fit. Once Cydia is fully loaded, tap on the Search tab on the bottom. Type, in the search field, "OpenSSH". Please Register or Log in to view images Tap on the OpenSSH package, and tap on Install on the top right. Tap on Confirm. Cydia will now install SSH on your device. Voilà ! SSH is now installed and ready to use. But wait ! You need to be able to access your device from a SSH client ! Here's how. Mac Open Spotlight and search for Terminal. Please Register or Log in to view images Launch the app. Please Register or Log in to view images To connect to your device, type (in Terminal): Code: ssh root@"your.ip.address.here" And press Enter. Terminal should now ask you for a password. The password is the same for all iPhones by default: Code: alpine Type that, press Enter, and you're in ! Please Register or Log in to view images Windows Download this program, called PuTTY. This is what allows you to access your iPhone from your Windows machine. Install PuTTY, and launch it. Enter your iPhone's IP Address into the "Host Name (or IP Address)" field in PuTTY and hit Open. (To find your iPhone's IP address, see the first Quick tip, above.) Accept any authentication dialogues that pop up. Log in with username "root" when prompted, with the password "alpine". Voilà ! Congratulations ! Your computer is now connected via SSH to your iPhone. You can now begin sending commands to your device ! Skip below to the Useful Commands section to start off right now ! But for those of you who are zealous... Here's how to install Terminal locally, on your iPhone. The advantages of doing this are huge. For starters, you don't need a connection to the Internet to enter commands on your device. (I'll always remember the time I replaced the hosts file on my iPod while on the road... I had put an ad-blocking hosts file manually, but SBSettings was now non-functional with it, so I had to restore the original hosts file...) Open up Cydia. Search for MobileTerminal. Tap on MobileTerminal Tap on Install, on the top right. Launch it from your home screen ! That's all there is to it, really. You now have a fully-functional Terminal on your iPhone ! You absolutely MUST do this Okay, great ! You now have SSH on your iPhone, enabled and ready to fire off. There's one thing you absolutely have to do. What you basically just did, is to allow remote access to your iPhone. That, combined with the fact that all iPhones have the same passwords by default, means that anyone who knows your iPhone's IP address, can get in just as easily as you can. Luckily, the solution is simple ! First, either connect to your iPhone from Terminal or PuTTY, or launch MobileTerminal (also called Terminal) on the device itself. Type this command: Code: su This tells the iPhone you want to be super-user, or root. If it prompts you for a password, type: Code: alpine You are now logged in as root on your iPhone. We will now change the default root password with passwd, the password-changing utility. Code: passwd You may have to type in your old ("alpine") password, to establish your identity. Now, enter a new password of your choosing, preferably a strong one with numbers, letters, and special characters. (Press Enter, as always) And re-type your new password, for confirmation. Now, do this: Code: passwd mobile You may have to type in your old ("alpine") password again. What we're doing is changing user "mobile"'s password, also, as "mobile" has almost as many privileges as root. This will secure the "mobile" account. Now, enter a new password of your choosing, preferably a strong one with numbers, letters, and special characters. (Press Enter, as always) And re-type your new password, for confirmation. Your iPhone is now SSH-ready, and fully secured against teen hackers who think they're cool when they use default-passwords to access other people's iPhones.