From ModMyiFone - Wiki
This method is outdated now. The new guide is here!
All right, this guide will teach you how to install ssh on your iPhone using iPHUC and sshkit from natetrue. ssh is necessary on the phone to install 3rd party apps like the ones here. This gets
What you need:
sshkit by natetrue.
iPHUC. If you haven't installed this yet, follow our iPHUC install guide to do so.
OS X. I assume you are running OS X on an Intel chip.
Step 1, download sshkit.
Create a new folder in your phonedmg folder (which should be in your Home folder in OS X) called sshkit and download the sshkit by natetrue, copying all the files from the kit into the sshkit folder you just created.
DO NOT drag the entire sshkit folder into the newly created one, just the files within it. To clarify, you should now have a folder at /phonedmg/sshkit with the contents in there.
Step 2, run iPHUC.
Open Terminal. If you don't know, its in Applications/Utilities/Terminal.app. Course, if you don't know, you haven't done the iPHUC install guide yet, so go do that. ;)
Run iPHUC by issuing the following commands (I am assuming here you installed iPHUC to the directory I suggested in the iPHUC guide, which is /phonedmg/iphuc):
cd /phonedmg/iphuc/iPhone/trunk/iPHUC
./iPHUC
Assuming all went well, you should see an output something like this:
iphuc 0.5.0
>> By The iPhoneDev Team: nightwatch geohot ixtli warren nall mjc operator
initPrivateFunctions: this is still not clean. Architecture: i386
AMDeviceNotificationSubscribe: 0
CFRunLoop: Waiting for iPhone.
notification: iPhone attached.
AMDeviceConnect: 0
AMDeviceIsPaired: 1
AMDeviceValidatePairing: 0
AMDeviceStartSession: 0
AMDeviceStartService AFC: 0
AFCConnectionOpen: 0
AFCPlatformInit: (no retval)
notification: Entering shell in Normal Mode.
shell: Entering loop.
(iPHUC) /:
Good. We need to gain full access, and I am assuming you have already followed our jailbreak Wiki. In order to do that, in iPHUC (which is in Terminal, for you n00bs ;), run the following command:
setafc com.apple.afc2
iPHUC has a weird glitch, so you'll get:
InvalidResponse
AMDeviceStartService AFC: -402653165
AFCConnectionOpen: 0
No problem. Type exit and hit return, then type ./iPHUC and hit return to restart iPHUC, then once again input setafc com.apple.afc2. You should have the follwing output:
AMDeviceStartService AFC: 0
AFCConnectionOpen: 0
(iPHUC) /:
Good. We're ready to go now.
Step 3, Install SSH.
Again, I am assuming you have downloaded the sshkit and put its contents in /phonedmg/sshkit. kk. In Terminal, we're gonna issue a bunch of commands. You're welcome to copy paste from here, in fact, I recommend it, its a pain to type out all of this. Here we go, do this:
getfile /usr/sbin/update /phonedmg/sshkit/update
and hit return. From now on in the tutorial I will not be telling you to hit return, but just assume you hit it after every command I tell you to type. :D You will also get a bunch of text (6 lines) in return after each command. Unless there's an error, don't worry.
If you get a "No such file or directory" error, try replacing
getfile /usr/sbin/update /phonedmg/sshkit/update
with
getfile /usr/sbin/update /Users/[myusername]/phonedmg/sshkit/update
If that works better for you, throughout the rest of the wiki, anytime the phonedmg folder is referenced, place /Users/[myusername]/ in front of that directory string. hope that helps anyone having the same problem i was having!
All right, moving on. Now enter the following:
getfile /System/Library/LaunchDaemons/com.apple.update.plist /phonedmg/sshkit/com.apple.update.plist
exit
cd /phonedmg/sshkit
cp com.apple.update.plist com.apple.update.plist.orig
cp update update.orig
cp chmod update
cp com.apple.update.plist.chmod com.apple.update.plist
cd /phonedmg/iphuc/iPhone/trunk/iPHUC
./iPHUC
setafc com.apple.afc2
putfile /phonedmg/sshkit/update /usr/sbin/update
putfile /phonedmg/sshkit/com.apple.update.plist /System/Library/LaunchDaemons/com.apple.update.plist
putfile /phonedmg/sshkit/au.asn.ucc.matt.dropbear.plist /System/Library/LaunchDaemons/au.asn.ucc.matt.dropbear.plist
putfile /phonedmg/sshkit/chmod /bin/chmod
putfile /phonedmg/sshkit/sh /bin/sh
putfile /phonedmg/sshkit/ls /bin/ls
mkdir /etc/init.d (yes, this one will not return anything. thats fine)
putfile /phonedmg/sshkit/hackinit.sh /etc/hackinit.sh
putfile /phonedmg/sshkit/dropbear.sh /etc/init.d/dropbear.sh
putfile /phonedmg/sshkit/dropbear /usr/bin/dropbear
putfile /phonedmg/sshkit/scp /usr/bin/scp
putfile /phonedmg/sshkit/libarmfp.dylib /usr/lib/libarmfp.dylib
mkdir /etc/dropbear (again, this one will return nothing)
putfile /phonedmg/sshkit/dropbear_rsa_host_key /etc/dropbear/dropbear_rsa_host_key
putfile /phonedmg/sshkit/dropbear_dss_host_key /etc/dropbear/dropbear_dss_host_key
exit
Press and hold the Power button on your iPhone until it shows the "slide to turn off" red slider.
Slide it, wait for the phone to turn off, and press the power button to turn it on again.
Do not run the next step till the above is successful.
cd /phonedmg/sshkit
rm update com.apple.update.plist
cp update.orig update
cp com.apple.update.plist.hackinit com.apple.update.plist
cd /phonedmg/iphuc/iPhone/trunk/iPHUC
./iPHUC
setafc com.apple.afc2
ls -l /var/run/dropbear.pid (this should return a "does not exist" error, don't worry)
putfile /phonedmg/sshkit/update /usr/sbin/update
putfile /phonedmg/sshkit/com.apple.update.plist /System/Library/LaunchDaemons/com.apple.update.plist
exit
Restart the phone.
Congrats! SSH is now installed on your iPhone! Yes, we are working on a script to automate this for the most part. Now you can install 3rd party apps by ssh'ing into your iPhone. The guide for that will be up tonight or tomorrow!
Props to duck_tape from #iphone.iphuc for his help on this.