Erica Sadun at TUAW posted a slick reference for getting the Dropbear SSH server running on the iPhone:
Over at the #iphone channel at irc.osx86.hu, the thoroughly awesome NerveGas has figured out how to enable ssh on the iPhone without using restore mode. The secret lies in overwriting an existing binary and plist to trick the iPhone into calling chmod on the Dropbear ssh server and making it executable.
At this time, NerveGas has used Nightwatch’s compiler to create iPhone-compatible versions of curl and ps as well as a number of other useful Unix utilities. (He’s working on grep, as I write).
This hack will let you use scp to transfer files to your device, as well as allow you to access the unix shell from another machine. There’s a working build toolchain now for the iPhone, so this is probably the most convenient way to upload and execute custom files on your iPhone from this point forward.
One other thing — when you’ve finished installing, make sure to change the password from the default “dottie”. From NerveGas’ SSH guide:
If you don’t like ‘dottie’, you can generate a new encrypted password by running:
perl -e ‘print crypt(“MYPASSWORD”, “XU”);’
Where MYPASSWORD is the new password you want, and XU is a random two-letter salt. Copy the encrypted output and replace the existing one in /etc/master.passwd on the phone.
You’ll want to do this for the two enabled accounts ‘root’ and ‘mobile’. Don’t forget — failure to change the default password is essentially giving everyone open access to your device.