Skip to Content

ssh on iPhone

Over at the #iphone channel at irc.osx86.hu, the thoroughly awesome NerveGas has figured out how to enable ssh on the iPhone without using restore mode. The secret lies in overwriting an existing binary and plist to trick the iPhone into calling chmod on the Dropbear ssh server and making it executable.

At this time, NerveGas has used Nightwatch's compiler to create iPhone-compatible versions of curl and ps as well as a number of other useful Unix utilities. (He's working on grep, as I write).

So what does this mean? Well, once you've got ssh installed on your iPhone and active, you can access your iPhone from a shell on your Mac. You can send and retrieve files using scp or sftp. And you can use the compilation toolchain to build other Unix utils or even your own software. It's just a short matter of time until perl and other command-line utilities are iPhone-ready.

Quick Reference

How To. You'll find NerveGas's excellent how-to here.

Necessary files. ssh kit and binaries (with many of the Unix utilities compiled for you).

NightWatch's Binary kit. Download here.

Other utilities. You can download curl, chmod, ps, ifconfig, grep, ed, vim, netcat. You can also find a compilation binkit here.

How do I ssh from my Mac? Look up the IP address under your WiFi settings (click the blue right arrow next to the WiFi network you choose). Then from the Mac's terminal, enter ssh root@IP address and use dottie as your password.

How do I get these to execute. Use /bin/chmod until you can get a shell going. For example, /bin/chmod 555 /bin/ls.

How do I enable scp and sftp? Use NiteWatch's binary kit. Make sure to install all the items in the /usr/tree including the /usr/lib files, otherwise you'll get an error when attempting to run the sftp-server.

How do I get a path to work? Run a shell, like csh, and use the path commands in the shell. I've set up a .cshrc to make things easier.

Where do I get the source for iPhoneInterface with getfile/putfile? The public svn, where you can pull the source, is here. You can grab the latest update to the main.cpp file here.

Thanks to NerveGas and also to pen-x for figuring out how to get Dropbear working and Nightwatch who got the entire compilation toolchain working, to iZsh, bricolage, and to BabyJesus.



Categories

Hacks UNIX / BSD iPhone

Over at the #iphone channel at irc.osx86.hu, the thoroughly awesome NerveGas has figured out how to enable ssh on the iPhone without using...
 

Add a Comment

*0 / 3000 Character Maximum

20 Comments

Filter by:
Nate True

Brandon: instructions on tethering your iPhone are here:
http://cre.ations.net/blog/post/tether-your-iphone

July 24 2007 at 9:03 PM Report abuse rate up rate down Reply
ArcTG

Hubert: Thank you for your spam.

More importantly, I just saw that the iPhone Dev Wiki posted the following security notice regarding shell access:

Progress Report

Some folks have "raised concerns" (to stay polite) that we were not officially releasing the ssh/shell binaries with instructions. Well, there is a good reason to delay it until we have a proper nice secure packaging for it: unfortunately, it seems a lot of people are currently installing these binaries regardless of basic security measures.

Installing the AFC plist exploit and/or a ssh-shell access on your iPhone is really not a good idea if you don't take the security of your iPhone seriously. It is highly advised that, you:

1. disable the AFC plist exploit (the Services.plist one) when you don't use it
2. change the root's password, disallow root access on the iPhone and create a new account (hint: edit /etc/passwd and /etc/master.passwd).

Because right now, if you don't do this, you're just wide open to any kind of virus/botnet attacks.

Hacking is fun, but stay safe ;)
-- the dev team

July 24 2007 at 4:26 PM Report abuse rate up rate down Reply
Hubert Lepicki

Wow. Now that is just another awesome news about iPhone (sarcasm).

The thing is that it's firmware is not free software, yes it can be built on top of max os X, or other Unix, but do they distribute this modified version? Do they provide useful build system? No. They are not OpenMoko guys :P

I'm not going to buy iPhone, nor advise it to anyone, while OpenMoko will be ready in couple of weeks / months? I'll wait.

July 24 2007 at 12:12 PM Report abuse rate up rate down Reply
ArcTG

Any links to an Intel OS X binary of dropbear rather than having to download Apple dev tools and compile?

July 24 2007 at 8:51 AM Report abuse rate up rate down Reply
Matt Johnston

Dropbear has a client too - you should just be able to compile it up (or they may have already??). Of course first you'd need a terminal app for the iPhone - not sure if they've got that far yet. Good to see some progress though.

July 23 2007 at 10:29 PM Report abuse rate up rate down Reply
R Muffet

Another excellent Quick Reference summary from Erica. Saves a lot of time.

But as for thanking *Baby* Jesus, I thought the iPhone was the JesusPhone, so that would make BJ kinda sorta Steve, and Steve's no spring chicken.

http://video.google.com/videoplay?docid=6542481355742550486&hl=en-AU

(Mind you, I never under the trinity thing. Was it the two Steves + Bill Gates from which all creation sprung? I guess Silicon Valley bible classes aren't what they are in Kansas.)

July 23 2007 at 9:39 PM Report abuse rate up rate down Reply
pixelslut

brillant. purchasing concerns now addressed. next 5 paychecks earmarked.

July 23 2007 at 7:14 PM Report abuse rate up rate down Reply
Kai Cherry

class-dump as well as otool -vT do what you're looking for Emanuele...

Try to keep up ;)

July 23 2007 at 6:05 PM Report abuse rate up rate down Reply
l0ne

Next step: compile a version of otool and nm that is able to read ARM Mach-O exe's, in order to begin understanding how the UI framework works :)

July 23 2007 at 5:56 PM Report abuse rate up rate down Reply
Brandon Crawford

WHOA... If you can enable RemoteGateway on the ssh server, theoretically you could connect to an ad-hoc wifi connection with your laptop and then ssh to it using a a faux-socks proxy on the laptop client and tether to your EDGE network connection.

I am going to try that now...

July 23 2007 at 5:29 PM Report abuse rate up rate down Reply
Buy an ad here

Hot Apps on TUAW

Tweets

© 2012 AOL Inc. All Rights Reserved.