You are using an outdated browser. Please upgrade your browser to improve your experience.

How to SSH / SFTP: A Walkthrough for Mac Users

August 5, 2008

Chances are that if you've followed one of our tutorials to jailbreak your iPhone, you might need some help on how to get files on and off.  One example of where this might be needed is putting NES Roms on the phone for the NES app that's available in Cydia. In this article I will walk you through the entire process of copying files to the iPhone using Mac software. A separate Windows tutorial will be available shortly for non-Mac users -- fear not we haven't forgotten you! A few things are required to be able to follow this tutorial:
  • iPhone/iPod must be jailbroken (see mac or windows tutorials for help)
  • Download an FTP Client  (see note below for a list of clients)
  • iPhone/iPod must be on WiFi (no Edge or 3g for SSH/SFTP)
NOTE: For this tutorial you will need an FTP client that is capable of transferring files using the SFTP protocol.  For Mac users we recommend Fetch ($15 / 15 day free trial).

Walkthrough:

1. Download OpenSSH from Cydia (see this Tutorial for help) OpenSSH is the server that will run on the iPhone that allows us to connect using SSH or SFTP applications.  Downloading OpenSSH will not add any icons to your SpringBoard as it runs in the background.  In the next step we will download an application that will allow us to turn on and off OpenSSH when it's not in use.

2. Download Boss Prefs from Cydia

Boss Prefs lets you control different settings of the iPhone/iPod without having to go through all of the settings menus.  It also lets us turn SSH on and off easily.

3. Open Boss Prefs / Enable SSH

Boss Prefs has a few switches -- SSH is probably already turned on, but open Boss Prefs just to make sure.  WiFi may show as off (even if turned on), go ahead and flip the switch to ON, your IP address will be shown in parenthesis next to the WiFi switch.  WRITE DOWN THIS NUMBER, you will need it to connect to the iPhone/iPod in the next few steps.  (In our screenshot the IP address is the 192.168.1.115 number you see next to WiFi below)

4. Set Auto-Lock to Never

SSH / SFTP sessions require that the phone be connected to WiFi.  When the phone locks, in order to save battery, it temporarily shuts off the WiFi connection.  Because of this we'll disable Auto-Lock on the phone for the duration of our session.  You might want to re-enable it after you're done transferring files.

5. Create an SSH session to the iPhone / iPod

Open up your SSH Client and connect to the phone.  The first connection will take 15-30 seconds as the phone will need to generate a security key.  This is normal. If your SSH Client times out, try connecting again, and your iphone will likely have finished creating the key by the second attempt.

Mac Users use Terminal.app which is built in to the Mac OS

Connect to the iPhone using the address you recorded in step 3

After 15-30 seconds type 'yes' when asked to accept the new key

When prompted for a Username type 'root' When prompted for a Password type 'alpine'

You can now type exit and close Terminal.app

6. Create an SFTP session to the iPhone / iPod

Now that the phone has all the required software, and we've generated our security key, we can begin transferring files to (and from) it.  For the purposes of this tutorial we'll show you how to accomplish a common request, putting NES Roms on the phone.  First, let's connect to the phone using our SFTP client.

For Mac Users:

Open Fetch

Create a connection to the iPhone using the address from step 3 Use the username and password in step 5 above (root / alpine) Make sure you select "SFTP" in the Connect Using box

After connecting you will be placed in the folder https://appadvice.com/var/root/

When opening the NES app on the phone it tells us we need to put ROM files in the https://appadvice.com/var/mobile/Media/ROMs/NES folder

Click Path to change to /var

From /var click through mobile, then Media

You will notice there is no ROMs folder inside of the Media folder, so we need to create it Click +New Folder to create a folder Type 'ROMs' (Case sensitive) in the new folder dialog

In the ROMs folder we need to create the NES folder Click +New Folder Type 'NES' (Case sensitive) in the new folder dialog

'Put' your .nes file in the newly created folder Click 'Put' Select your rom file (must end in .nes)

7. Disable SSH and turn on Auto-Lock

Now that you're finished with your SSH connection you can shut it off.  This will free up some memory, as well as keep unwanted connections from being made to your phone without your knowledge.

7. Open NES and enjoy your new ROM file!

Summary

Though we used NES emulator as a basis for this walkthrough the steps may be applied to a lot of other tasks.

Some other uses for SFTP on the iPhone are:

  • Manually installing applications not available in Cydia
  • Transfer voicemail from iPhone to a computer (see this article)
  • Removing unwanted applications from the iPhone / iPod

You also have the ability to create a terminal session with the iPhone.  From within terminal you can change permissions on files and folders, delete files, edit preferences, and various other things.

Some key things to remember when following this tutorial:

  • Set Auto-Lock to Never
  • Remember IP Address from Boss Prefs
  • Username and Password are case sensitive
  • Username is: root
  • Password is: alpine
  • Turn off SSH in Boss Prefs when done
  • Turn on Auto-Lock when done
If you need help, ask questions in the comments below!

Related articles