You need a jailbroken iPhone for this.
- use Cydia to install the OpenSSH package
- enable WLAN access and find your iPhone's IP (see Settings → Wi-Fi → \<Your Network SSID> → IP Address)
- under Linux type:
ssh <IP address> -l root; for Windows use PuTTY
- (the first connection will need about 20-30 seconds before you'll be asked to accept the host key)
- use the following password:
alpine (older iPhones used