Although using iBrickr or iFuntastic to get files and applications on and off your iPhone is fine, it's sort of a pain to have to dock it every single time you've got a new NES ROM you want to play. There's an easier way thanks to SSH, the remote command line tool that Linux and Unix users have been using since 1934. With this, you can browse and copy files to and from your phone with either a command line or even a FTP client that supports SFTP. Here's what you do.
Connecting to the command line:
The first step is to jailbreak your phone. Jesus's guide will get you started with both AppTapp for Mac and iBrickr for Windows. They're both just as good. If you're on Windows and using iBrickr, you have to go to the extra step of installing Installer.app onto your phone. You can do this inside the Applications section of iBrickr.
Now, open up Installer on your iPhone and install the "BSD Subsystem", "Community Sources", and "OpenSSH". OpenSSH installs the program that lets you connect onto the iPhone remotely, and BSD Subsystem gets you some command line tools on the phone itself to do some file manipulation. Once done, turn your phone off and on (just to be safe) and you should be ready to connect.
Next, connect to your home's Wi-Fi network and find out what your iPhone's IP Address is. It should be listed under the clients section of your router's configuration pages. An even easier way is to look in your Settings App, under the Wi-Fi network you're currently connected to. [Thanks Ravi!]
If you're on a Mac, you already have a built-in SSH client. If you're in Windows, you can use Putty. Now, open up Terminal (Mac) or Putty (Windows) and connect to your iPhone.

On Mac, just type in "ssh root@IPADDRESS" without the quotes. Accept any authentication requests that pop up. Type in "dottie" as the password when prompted.
On Windows, enter in the IP Address into the "Host Name (or IP Address)" in putty and hit Open. Accept any authentication dialogues that pop up. Log in as "root" when prompted, with the password "dottie".
Once you're in, you can move around freely with these command line basics.
If you have programs like Erica's Tools installed, you can even take screenshots and copy them onto your desktop.
Copying Files:
Although you can easily copy files from the command line, the easiest way is to do it graphically with an SFTP client. On Mac, you can use Transmit. On the PC, there's WinSCP. The basics are the same, Just enter in your IP address, the login (root), and password (dottie). Now you can drag and drop files to and from your phone easily.
Changing your password:
If you enable SSH on your phone, you should change the password from "dottie" as soon as possible, otherwise people can easily get into your phone and find out what horrible, horrible taste in music you have.
Just log in to your iPhone, then type "passwd". You'll be prompted to enter in the new password. Thanks Premek, I didn't know it was installed!
Deprecated instructions below:
On Mac, type in:
perl -e 'print crypt("MYPASSWORD", "XU");'
Where "XU" is a random two letter combination to randomize your password a little more.
On Windows, you'll have to download and install perl before you run that command. (This is a stupid way to do it. Does anyone know of an online generator or an easier way for Windows?)

Once you have your new encrypted password from the output of that command, copy the file /etc/master.passwd from your iPhone onto your computer, and replace the root password in the file. The relevant line looks like this:
root:XXXXXXXXXXXXX:0:0::0:0:System Administrator:/var/root:/bin/sh
Replace only the X's with your new encrypted password, making sure not to mess up the colons, and upload this back into your phone under /etc/master.passwd Now, reboot the phone. Your new password should be in place.
That's it! If you have any questions or see any holes, make a comment.












Comments
Instead of typing in the perl stuff and doing the whole copy and paste thing to set your password you can just type this
passwd
and then type in your new password. that's all there is to it.
Since the executable "passwd" is installed, why not change the password with it? Certainly easier and standard way ... when logged as root, simply type passwd and input the desired password twice. Works right away, no restart necessary (just try to login again)
Forgot to say - do it when logged on an iPhone (via installed terminal or with ssh).
@premek: Thanks premek. Didn't see that it was installed!
I've been reading contradictory reports on whether or not having OpenSSH installed is a battery drainer.
See here: [ask.metafilter.com]
What do you guys think? It really runs only on-demand, or the daemon is running all the time consuming the battery?
@xdcdx:
Well, I don't know how scientific this is, but I ssh'd in to the iPhone that's been up and running for a while (of course with OpenSSH installed) and did a Top. Here's what I got:
Processes: 22 total, 1 running, 21 sleeping... 83 threads 16:31:47
Load Avg: 0.35, 0.11, 0.04 CPU usage: 9.9% user, 11.7% sys, 78.4% idle
SharedLibs: num = 0, resident = 0B code, 0B data, 0B LinkEdit
MemRegions: num = 2661, resident = 47.1M + 0B private, 20.8M shared
PhysMem: 18.3M wired, 20.4M active, 10.5M inactive, 49.2M used, 2.03M free
VM: 298P + 0B 10412(0) pageins, 0(0) pageouts
PID COMMAND %CPU TIME #TH #PRTS #MREGS RPRVT RSHRD RSIZE VSIZE
19516 top 9.9% 0:08.69 1 17 47 832K 472K 0B 4.45P
18928 sh 0.0% 0:01.19 1 13 30 304K 960K 0B 4.22P
18897 sshd 0.0% 0:02.00 1 14 30 328K 608K 0B 2.89P
14560 MobileSlid 0.0% 0:41.77 2 77 188 2.14M 4.71M 781T 10P
13476 MobileMusi 0.0% 0:01.95 2 49 166 2.02M 4.73M 234T 11P
7667 MobileSafa 0.0% 2:01.46 6 181 442 18.6M 12.7M 2.37P 141P
48 MobilePhon 0.0% 0:04.31 2 103 210 2.83M 6.43M 0B 21P
27 notifyd 0.0% 0:10.18 2 152 25 212K 252K 0B 1.58P
26 PXLdaemon 0.0% 0:02.11 1 15 103 584K 1.19M 0B 3.31P
25 mediaserve 0.0% 0:08.83 14 150 166 1.41M 1.61M 78.1T 7.44P
24 ptpd 0.0% 0:01.39 2 51 71 512K 1.04M 0B 3.97P
22 syslogd 1.8% 12:55.79 3 35 28 216K 272K 0B 1.67P
21 lockdownd 0.0% 0:02.47 3 46 74 596K 884K 1.18P 4.67P
20 mDNSRespon 0.0% 0:03.13 2 45 48 424K 580K 0B 3.27P
19 iapd 0.0% 0:05.29 4 80 144 900K 2.09M 0B 5.89P
18 cron 0.0% 0:01.15 1 13 42 276K 364K 0B 1.84P
17 crashrepor 0.0% 0:01.06 1 41 60 364K 456K 39.1T 2.20P
16 configd 0.0% 0:35.50 4 129 68 700K 852K 0B 5.39P
15 SpringBoar 0.0% 2:16.05 13 211 545 12.3M 13.5M 390T 47P
13 CommCenter 0.0% 0:09.51 10 87 76 928K 700K 0B 5.59P
12 BTServer 0.0% 0:01.48 5 53 70 588K 1.09M 0B 5.19P
1 launchd 0.9% 9:08.00 3 65 28 232K 296K 0B 1.67P
So, even while OpenSSH is being actively used (i.e., me logging in, running Top, etc.), it's consuming very little CPU cycles.
I use this with Cyberduck for Mac... works like a charm.
Just set the client to SFTP and configure the same way.
I was at work and sshed into my co-workers Linux box 4 weeks ago. Did a wall on his machine while sitting in his office and totally freaked him out.
!!! There is an step missing from these instructions !!!
1. Install "BSD Subsystem"
2. Install "Community Sources" (This is missing- Installer v2.63 has this intermediate application)
3. Install "OpenSSH"
Can anyone access the iunlock post that's just a few posts under this one? Has that post been locked?
I meant the AnySim Iphone Unlock app... i recalled reading some helpful comments under that post, but it seems like the comments section has been locked. I just purchased an iphone and wanted to try to unlock it.
Well, thanks to user Mercury7 on Engadget I found the directions to using unlocking iPhone using AnySim. Here it is for those of you looking for it:
---WINDOWS USERS---
Unlock your iPhone without any prior hacks needed.
Follow these steps to install anySIM.
1. Download and install iTunes 7.3.0.5 - [www.pqdvd.com]
2. Download and extract iBrickr 0.8 to your desktop - [cre.ations.net]
3. Connect your iPhone
4. Launch iBrickr.exe from the directory you installed it to
5. Follow all instructions in iBricker to Jailbreak your phone
6. Relaunch iBrickr
7. Click "Applications"
8. Follow instructions to install PXL
9. Click "Browse"
10. Click "anySIM"
11. Now, it's installed on your phone.
Follow these steps to unlock your phone after you've installed the application.
1. Disconnect your phone from the computer.
2. Follow these instructions to install a different sim card - [www.maclife.com]
3. Ensuring the new card is installed properly, launch anySIM from your iPhone springboard (the icons on the home page)
4. Agree to the agreement (press OK)
5. Wait for a while (~15 mins)
6. You're done!
Yay! BSD subsystem on an iPhone? Now all you need is to install Apache on there, and set up your iPhone as a webserver... Anyone going to try it?
Anyone going to try and install apache on there now you have BSD subsystem and openSSH to get stuff there?
Who will have the first publically accessable iPhone webserver?
Does this version of sshd support the ability to forward a port across the connection? If so, I'm wondering if I could setup an iPhone such that Safari used a proxy at 127.0.0.0.1:80, then have ssh forward that port across the connection and into my company's network, allowing me to view internal company web pages using my phone! :)
After I connect using PuTTY it allows me to enter the username "root" but then doesn't allow me to type in the password??
The password is "alpine" now.
terminal doesn't accept the password dottie on my comp. can anyone tell me why?
Mine too! Not logging in with "dottie"
@emburaman:
There is a bit of confusion on this. On my phone s/w v1.1.3,
user:root
pass:alpine
works well.
On a related note, while using MobileTerminal application (v1.0) on the phone, I am unable to "su" using the same password. I keep getting incorrect password error.
Has anybody seen this problem?
Neither dottie nor alpine gets me to root.
@xdcdx:
Comment on Short and Sweet SSH Guide for the iPhone i know its pretty late... but definitely the SSH consumes a lot of battery.
@rambert:
Comment on Short and Sweet SSH Guide for the iPhone well, i tried fixing the safari cookies folder bug in which safari forced me to enter the user pass a zillion times. but when i installed the term-100 i experienced that i couldn't log in with neither the dottie nor the alpine... however i decided to restore the phone to 1.1.4 completely and then ziphone 3.0 now i don't have the safari bug. haven't checked the term login bug yet... so far, havn't had a need for that. I also encourage you to try the AFP service in the iPhone and pressing CommandKey + K it allows for easy transfering anything back and forth
Better not use "passwd" to change your password, it got MY phone stuck in an infinite loop. If you are too one of the unfortunate, follow the instructions at: http://blog.matsimitsu.nl/english/183/howto-fix-the-edit-home-screen-loop-for-iphone
Start a discussion:
Login with your username and password below. Or comment on this post via email.
Forgot your username or password? New User?