I'm doing quite a bit of hacking with the iPhone and for convenience sake I need to get to it through the terminal on a regular basis. Here's some tips for making this much smoother and more secure for accessing it.
- Install a SSH daemon on the iPhone using installer.
- Edit your DHCP server on your local wireless network to always assign the same IP address to the iPhone (most Linksys, DLink, etc support this, you'll need the mac address of the iPhone which you can infer from "arp -an" on your command line).
- Add that IP address and hostname to your /etc/hosts, something like:
10.0.1.111 iphone - Edit your local ~/.ssh/config file to make root the default user to SSH to the iPhone:
Host iphone user root - Make an .ssh directory on the iPhone:
ssh iphone mkdir /var/Root/.ssh - scp your ssh public key to the iphone:
scp ~/.ssh/id_dsa.pub iphone:/var/Root/.ssh - Fix the remote permissions:
ssh iphone chmod -R 700 /var/Root/.ssh
There you go, you should now be able to SSH to your iPhone with ease. I'd suggest also getting bossprefs and turning off SSH when it's not in use, otherwise you could set SSHd to only do key authentication, not password (I haven't tried this so it may not work). Don't change the root password on the iPhone, some versions can get really messed up by doing this forcing you to reinstall the iPhone OS.


