We never seem to get round to doing enough of these How-To sort of posts, but I’m trying to knock out a few on topics that seem to come up frequently on iPhone forums and discussions – such as …
How To Connect to Your iPhone Via SSH
Topic Description: SSH (secure shell) is a network protocol that allows data to be exchanged over a secure channel, in this case between a computer and your iPhone. If you have a jailbroken iPhone, an SSH connection over a wireless network is often the best way to browse your iPhone, carry out simple file transfer back and forth to the iPhone, or manually install applications to it. This short guide provides a rundown of how to establish an SSH connection to your iPhone.
Requirements & Assumptions:
A jailbroken iPhone. For this guide we will assume you are running the current latest iPhone firmware, Version 1.1.4.
The BSD Subsystem installed on your iPhone. You’ll find this under the System category in Installer.
OpenSSH (or another SSH variant) installed on your iPhone. This is also found under the System Category in Installer.
iPhone and computer need to be on the same (usually wireless) network. For the sake of this guide, we’ll assume both are on a home wireless network.
An ability to turn SSH On and Off on the iPhone. SSH programs on the iPhone do not create an icon on the home screen, so one of the easiest ways to do this is to use the BossPrefs application on the iPhone (to install it you’ll need to add the BigBoss source to Installer – which is http://sleepers.net/iphonerepo). There are other iPhone applications that do this as well, but BossPrefs is currenty the best of these in my view.
- Make a note of your iPhone’s IP address. To find this, on your iPhone go to Settings > WiFi and tap on the blue arrow to the right of the name of your home network. On the screen that comes up, note the set of numbers listed in the IP Address field.
- Turn SSH On, on the iPhone. With BossPrefs and other similar applications, this is just a matter of tapping on the SSH entry to toggle it on and off. Please Note: it is good idea to make sure you toggle SSH back off when you are through using it.
- Launch your SSH app on your computer. WinSCP will land you on a new ‘Session’ screen straight away. On Cyberduck, you’ll need to choose ‘Open New Connection’. See screencaps at the top of this post and below for a look at how these screens appear. Then you need to fill in a few fields to specify how you want to connect and what device you want to connect to. The fields are named slightly differently depending on which program you use, but they are similar enough that you should be able to fill them in as follows:
Hostname or Server = enter your iPhone’s IP address in this field
File Protocol = should be SCP on WinSCP and SFTP on Cyberduck
Username = enter ‘root’ (without the quotes) in this field
Password = enter ‘alpine’ in this field (without the quotes) or whatever you have changed root’s password to, if you have ever changed it.
- Once you have entered the information as above, hit ‘Login’ on WinSCP or ‘Connect’ on Cyberduck. It may take up to 30 seconds or so to connect.
- You will see a confirmation message asking if you will accept key exchange / connection with the device with the iPhone’s address. You’ll need to say Yes or Allow on these.
Once connected, you are presented with an Explorer-like view of the file system on the iPhone, or of the iPhone and your own computer. Once there, you can copy files and folders back and forth between the computer and iPhone.
UPDATE: There is shiny, new updated version of this post HERE – with some changes to reflect the current jailbreak environment, the Cydia app store, and newer jailbreak apps that are helpful in this process.