SSH via a USB connection and using FTP
Updated: January 4, 2014
Note: If you are only interested in using Cydia or the App Store to
install applications on your iPhone, then you do not need to perform anything in this
tutorial. This tutorial is strictly for those who need to interact with their iPhone's
file system to perform advanced level tasks.
In this tutorial I'll cover how to use SSH over a serial connection (your iPhone's USB
sync cable). This is great if you are on the road and don't have access to a Wi-Fi network
as you can still interact with your iPhone's file system in a more robust way than using
a program like DiskAid, iExplorer or PhoneView. I came across this process in a thread
over at the MacRumors forums. "-aggie-" detailed the process
here in
post 14. A big thank you goes out to him!
I realize that
DiskAid,
iExplorer and
PhoneView can also interact
with your iPhone's file system easily (and at a cost), however none of those programs
allow you to change file permissions (and there may be other things they can't do as well).
Should you decide to want to use SSH over Wi-Fi then you should read my other SSH
tutorial. It will be important to change your root and mobile passwords, and install a
toggle so that you can shut off SSH.
Step 1.
Press Settings, General, Auto-Lock and set it to Never. You should always do this when
working with SSH. If the iPhone should sleep, you will lose your connection and
possibly data. If this happens during a critical process you could damage the iPhone, or
have data corruption issues. Don't forget to set this back when you are done or the
screen will not shut off!
Step 2.
Download iPhoneSSH
here. When you see
the file on the left appear, double click it to decompress it and you'll have a folder.
Step 3.
Launch Cydia. Press the Search button at the bottom. Enter openssh then press the Search
button. Your results will be displayed. Select the program. Press Install.
Press the Confirm button. You'll see a status report of the install process like this.
When it has finished, press the Return to Cydia button. You can then close Cydia at this
point.
Step 4.
On your Mac go to your Applications folder, and then into the Utilities folder. Launch
the Terminal.app program. In the terminal window type the letters
cd
Press the space bar once. Open the iPhoneSSH_USB folder that you just decompressed. Drag
the python-client folder into the Terminal window.
The path to that folder will now be added in the Terminal window.
Press enter then type
python tcprelay.py -t 22:2222 &
Press enter. You should receive a reply message immediately.
Step 5.
Download YummyFTP
here.
Note: many other FTP programs can be used as well.
Launch YummyFTP. Click the Add button. Enter the following values. The default password
is alpine (you may have changed it already). Click Save.
Double click the iPhone SSH USB entry to make the connection.
Your computer's file system is on the left, the iPhone's on the right.
To change permissions on a file first select the file you want to modify then right click
it and select Get Info.
You could also change permissions in the Terminal used below. The Terminal window will
let you know that it is connected and relaying data to your iPhone based on its serial
number (displayed in hex).