Short and Sweet SSH Guide for the iPhone

Click to viewAlthough using iBrickr or iFuntastic to get files and applications on and off your iPhone is fine, it's sort of a pain to have to dock it every single time you've got a new NES ROM you want to play. There's an easier way thanks to SSH, the remote command line tool that Linux and Unix users have been using since 1934. With this, you can browse and copy files to and from your phone with either a command line or even a FTP client that supports SFTP. Here's what you do.

Connecting to the command line:

The first step is to jailbreak your phone. Jesus's guide will get you started with both AppTapp for Mac and iBrickr for Windows. They're both just as good. If you're on Windows and using iBrickr, you have to go to the extra step of installing Installer.app onto your phone. You can do this inside the Applications section of iBrickr.

Now, open up Installer on your iPhone and install the "BSD Subsystem", "Community Sources", and "OpenSSH". OpenSSH installs the program that lets you connect onto the iPhone remotely, and BSD Subsystem gets you some command line tools on the phone itself to do some file manipulation. Once done, turn your phone off and on (just to be safe) and you should be ready to connect.

Next, connect to your home's Wi-Fi network and find out what your iPhone's IP Address is. It should be listed under the clients section of your router's configuration pages. An even easier way is to look in your Settings App, under the Wi-Fi network you're currently connected to. [Thanks Ravi!]

If you're on a Mac, you already have a built-in SSH client. If you're in Windows, you can use Putty. Now, open up Terminal (Mac) or Putty (Windows) and connect to your iPhone.

Short and Sweet SSH Guide for the iPhone



On Mac, just type in "ssh root@IPADDRESS" without the quotes. Accept any authentication requests that pop up. Type in "dottie" as the password when prompted.

On Windows, enter in the IP Address into the "Host Name (or IP Address)" in putty and hit Open. Accept any authentication dialogues that pop up. Log in as "root" when prompted, with the password "dottie".

Once you're in, you can move around freely with these command line basics.

If you have programs like Erica's Tools installed, you can even take screenshots and copy them onto your desktop.

Copying Files:

Although you can easily copy files from the command line, the easiest way is to do it graphically with an SFTP client. On Mac, you can use Transmit. On the PC, there's WinSCP. The basics are the same, Just enter in your IP address, the login (root), and password (dottie). Now you can drag and drop files to and from your phone easily.

Changing your password:

If you enable SSH on your phone, you should change the password from "dottie" as soon as possible, otherwise people can easily get into your phone and find out what horrible, horrible taste in music you have.

Just log in to your iPhone, then type "passwd". You'll be prompted to enter in the new password. Thanks Premek, I didn't know it was installed!

Deprecated instructions below:

On Mac, type in:

perl -e 'print crypt("MYPASSWORD", "XU");'

Where "XU" is a random two letter combination to randomize your password a little more.

On Windows, you'll have to download and install perl before you run that command. (This is a stupid way to do it. Does anyone know of an online generator or an easier way for Windows?)

Short and Sweet SSH Guide for the iPhone

Once you have your new encrypted password from the output of that command, copy the file /etc/master.passwd from your iPhone onto your computer, and replace the root password in the file. The relevant line looks like this:

root:XXXXXXXXXXXXX:0:0::0:0:System Administrator:/var/root:/bin/sh

Replace only the X's with your new encrypted password, making sure not to mess up the colons, and upload this back into your phone under /etc/master.passwd Now, reboot the phone. Your new password should be in place.

That's it! If you have any questions or see any holes, make a comment.