How to SSH your iPhone without WiFi [TIP]

Until very recently I did not mind not having WiFi at home. With a generous data plan, and a very decent 3G coverage in every single room of my house, I did not need it. I have tried SSH’ing once a long time ago, more so to experience what all the fuss was about. However I found Phoneview (to transfer files between my computer and my jailbroken iPhone) and iFile (to manage my files on the iPhone itself) where more than enough to keep me away from the Terminator (i.e. the Terminal). However, with Apple releasing the iOS 6 betas, and Redsn0w being but a partially working jailbreaking solution for the new firmware, SSH’ing became the only way to access your iPhone’s root. And here I was, stuck. I even went to many McDonald’s restaurants (which provide free WiFi to its customers here in Australia) only to find it impossible to SSH my iPhone using their networks. Argh!

Then I discovered a miracle tool. Simply called iTools. It is an application (still beta but working great) made by a Hong Kong developer which offers many great functions, including that of SSH’ing your iPhone via USB cable (so called SSH tunnelling). You can read the description and download it from here (or from here if your Chinese is a bit rusty). By the way, it works on Mac OS X 10.8 (Mountain Lion) as well.

Remember that if your are trying to SSH your iPhone with iOS 6 beta jailbroken with one of the Redsn0w dev tools, you need to boot tethered before you begin. Once you download iTools, open the app while your iPhone is connected to your computer by a USB cable. You will be greeted by the following screen:

iTools has many great functions, including easy installation of apps (.ipa files), music, and ibooks directly onto your iPhone (by simple drag and drop), bypassing the often frustrating iTunes. You can find out how to do it by playing around and selecting different options on the left tab menu. If you want to SSH your iPhone via USB cable, you need to choose the last item on that left tab menu: Advanced Function. This will open up the following screen:

On this screen click on the Open SSH Tunnel icon. This will open your Terminal app and you will be immediately greeted as follows:

Write ‘yes’. You will then be prompted to enter your password. The default password on all iPhones is ‘alpine’ (CaPiTaLiZaTiOn matters). Badaboom babadam et voila, you are now SSH’ed to your iPhone without WiFi.

The first thing that I suggest you do is change your password from ‘alpine’ to something less “obvious”. Enter the command ‘passwd’ and follow the prompts to change your password.

Feel free to read my tutorial about How to Install a Working Cydia on iOS 6 beta 3 and 4, for which you will need to SSH your iPhone.

Occasionally, when you open the SSH Tunnel, you may be greeted differently:

What you need to do is modify your known_hosts file. You find it using Finder. In the top bar menu choose Go, then Go to Folder. Search for following folder:

known_hosts is within the .ssh folder. Open it with TextEdit and remove all but the first part of the string coding for your SSH-RSA key (i.e. remove all the text within the orange rectangle)

Save the modified file and try opening iTools again. It should now work.

Please do not hesitate to contact me or leave a comment below about your experience. And feel free to share the news!

18 comments

  1. Keegan Lillo

    You’re gonna hate me for this, but you can actually SSH right into the phone over USB if you have personal hotspot turned on. (works over wifi and bluetooth too)

    turn on personal hotspot in the iphone’s settings and choose a method below.

    wifi tethering:
    use the “Router” IP found in the advanced section under TCP/IP of the wifi device in network settings in system preferences

    USB Tethering:
    have a look at your IP in system preferences and just use a 1 at the end isntead of whatever IP you were assigned. eg: 172.20.10.2 becomes 172.20.10.1

    Bluetooth:
    same deal as USB 172.20.10.11 becomes 172.20.10.1

    should look something like this: ssh root@172.20.10.1

    cheers,
    Keegan

  2. Jerry

    You can alternatively also create a sharing hotspot, on your mobile phone or any internet source (ie Ethernet) that may be attached to you computer with a wireless adapter.

  3. mnk

    this program does not open the way you are posting to this black screen on my windows 7 is dead when you press open ssh tunnel just says open and then you click says close. it does not o it like you posted.

  4. David S. Uria

    Hi there, have jailbreaked my iPhone 4, with redsnow, now can’t seem to SSH, even after downloading that program Itools, still get various errors,Last login: Sun Sep 23 22:28:10 on ttys001
    Davids-iMac-2:~ David$ ssh root@127.0.0.1 -p 5000
    ssh_exchange_identification: Connection closed by remote host
    Davids-iMac-2:~ David$

  5. David S. Uria

    This is what it gave me today:

    ast login: Mon Sep 24 15:44:15 on ttys001
    Davids-iMac-2:~ David$ ssh root@127.0.0.1 -p 5000
    ssh: connect to host 127.0.0.1 port 5000: Connection refused
    Davids-iMac-2:~ David$

  6. kr1sis

    @David S. Uria
    Looks like an OpenSSH/SSL problem. Check if you have it set up on your iPhone (look for the files with a program like iExplorer or Phoneview).
    Otherwise look in the comments section on the post I wrote about iTools… Someone mentioned about SSH’ing using Personal Hotspot. Good luck!
    K

  7. njunik

    Hi (and tnx for your work). Same problem to me. ssh installed but all connections are refused (i think the daemon doesn’t generate the cert rsa etc because they aren’t in the dir /etc/ssh/). Some idea how force generation? or maybe how reinstall openssh with a startup script? I have whole access to filesystem (and the jailbreak is untethered :D)

  8. chris

    i followed your steps and it sworked for my phone but am trying with another phone and im at the alternative method that you had for ssh and i entered yes and password and entered in the code for cydia hit enter and it just goes back to root# it won’t respiring.

  9. Kale

    when i type in the cydia download, i get this…

    iMoney:~ root# wget -q -O /tmp/cyinstall.sh http://downloads.kr1sis.net/cyinstall.sh && chmod 755 /tmp/cyinstall.sh && /tmp/cyinstall.sh
    /tmp/cyinstall.sh: line 1: unexpected EOF while looking for matching `”‘
    /tmp/cyinstall.sh: line 2: syntax error: unexpected end of file
    iMoney:~ root#

    asking for another prompt. what is wrong?