Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Knolly

macrumors 6502a
Original poster
Jul 22, 2007
610
0
EDIT: DiskAid is far far easier. Ignore the rest of this tutorial.

Disclaimer: Technically you're not SSHing... You're just making a USB connection that accomplishes the same thing.

So anyhow, I had a need for this setup due to a really complicated WiFi situation that made SSHing a huge ordeal... So here we go!

1. Download and install:
MacFuse
Disk for iPhone
Then restart your computer.

2. Plug in your iPhone.

3. Open Disk for iPhone. Media will show up on your desktop.

4. Click on the Disk for iPhone icon in the status bar and select root.
StatusItemScreenshot.png

(Yeah, I know, pic taken from their site because I'm too lazy to go make screenshots and this is pretty dead simple)

5. Root will show up. Now the slightly tricky bit is that Aliases within the root directory do NOT work. So, go to the following: private/var/stash. Or, with root mounted, open Finder, click Go on the status bar and select Go to Folder and copy and paste "/Volumes/Root/private/var/stash."

The stash folder is where you'll find Applications and Themes, among other things. While there are other things you can do with SSH those two are by far the biggest ones.

And there you go, that's all there is to it. Quick protip so you don't have to bother with folders though: If you make an alias to the stash folder and put it on your Mac somewhere, all you have to do is connect the iPhone, start Disk for iPhone, select root, and double click on the alias to get where you need to go.
 

Bear Hunter

macrumors 6502a
Aug 10, 2008
598
0
Why don't you just create an ad-hoc network between your computer and phone and SSH that way? That way your not relying on an external Wifi source.
 

cava857

macrumors newbie
Dec 28, 2008
1
0
Help

hey me too, i was trying to do the mobile installation thing, and it crashed, i have to restore it :mad:
 

sjorge

macrumors member
Jul 30, 2008
44
0
bah here I was hoping to have a bash shell on the iphone without having wifi running. a lot of people seem to confuse ssh with scp (sftp) which uses the ssh protocol for file copy. :(
 

DirtyDan

macrumors member
Jan 1, 2009
49
0
Nevada, Texas
I messed with both, DiskAid was much easier, faster, seems more stable/secure, and it doesn't require a restart.

However, MacFuse is free and DiskAid is only a 14 day demo.

I'd rather pay for the easy stuff. :D
 

fullprooffed

macrumors newbie
Jul 13, 2009
1
0
Another way is to install the tethering profile (on iphone) from help.benm.at/help.php, then set up tethering via usb by following the provided directions, then download Transmit from the apple site and set up the ssh file transfer like you would do in Cyberduck or any other ssh client. The tethering connection uses the usb cable versus using a wifi connection.
 

Knolly

macrumors 6502a
Original poster
Jul 22, 2007
610
0
Massive agreement that DiskAid is easier... It either wasn't out or for some reason I didn't know about it when I wrote this.
 

mohicanspap

macrumors regular
Jul 19, 2008
230
0
Why don't you just create an ad-hoc network between your computer and phone and SSH that way? That way your not relying on an external Wifi source.

How would one manage a ad-hoc network? I already know how to connect the two devices but how to you access the iPhone through Cyberduck? Is it a FTP or a SFTP?
 

Halcylon

macrumors newbie
Jul 28, 2009
20
0
I still managed to botch this up regardless of the simple instructions. I downloaded Disk for iPhone and restarted, having already had MacFuse and now when I plug in the iPhone and run Disk for iPhone it closes immediately.
 

phonique

macrumors newbie
Dec 5, 2009
4
2
The real solution

Until novi's iphone tunnel works again...
(Obviously, works only if you have SSH or another server installed on your iPhone/iTouch.)

1. Download iPhoneSSH.tar.bz2 (~25KB) from here:
http://rapidshare.com/files/316653216/iPhoneSSH.tar.bz2
(MD5: 9cd9253f1170587bc00d9f87e12402d8)
or
Download the latest usbmuxd distribution from here:
Abort, Retry, Hack? usbmuxd
2. Unpack to a convenient location (you just need the "python-client" folder if you downloaded the usbmuxd distribution)
3. Open terminal, change directory to the python-client-folder and type:
python tcprelay.py -t 22:2222 &
(the -t is for threaded-mode, meaning that you will be able to open more than one session/forward more than one port (as shown below))
4. Now open Fugu or another terminal session and connect to localhost @ port 2222 i.e. like this:
ssh -p 2222 root@localhost

Enjoy SSH over USB!

Additional info in the author's words:
[01:55] marcan:
you can forward any ports
[01:55] marcan:
where the iPhone is the server, and the PC the client
[01:56] marcan:
if you want to do the opposite, you could use socat to reverse the client/server roles or just use ssh forwarding/reverse forwarding (which will be slower though, due to the encryption)
[...]
[01:57] marcan:
also, TCP only of course
further:
[01:52] marcan:
you can also add other ports
[01:52] marcan:
such as ./tcprelay.py -t 22:2222 5900 &
[01:52] marcan:
which will forward VNC
[01:52] marcan:
(if you have veency installed on the phone)
[01:35] marcan:
most of the dirty RE work was done by others, re: the hash
[01:35] marcan:
I just put some of the finishing touches on :)

Drop Héctor Martín Cantero a line saying thanks for those <finishing touches> here: hector@marcansoft.com

Enjoy!

Tested and confirmed working on 10.6.2 and iPhone 3.0-JB.
 

mjamz

macrumors newbie
May 25, 2010
2
0
Thanks phonique!
It worked for me too, just want to stress out for everyone trying this out: don't forget to enable ssh mode on your iPhone and you have to switch your terminal session. (Didn't get it at the first try, phoniques HowTo is not hard but you have to read it twice! But then it is really easy!)
My iPhones modem broke (as with many other iphones these days..) and I worried if I could continue SSHing into it. It works and it saved "my" iPhone for me: SSH is so much more than a file viewer, it allows you to use your Phone like a computer.
 

thedoobieman5

macrumors newbie
Jun 11, 2009
16
0
I just did things phonique's way and I can SSH like it's nobody's business (plus it's way faster). However, I can't seem to copy files back and forth. When I use scp I'm asked for a password that isn't any of the ones I use. Does anyone know what's going on?


EDIT:
Nevermind, the answer was in the man pages all along. Anyone that's having the same problem should note that "scp -P" is what should be used, not "scp -p". Excuse my n00bishness.
 

lawlist

macrumors member
May 19, 2010
68
0
ssh via usb iphone mac osx python terminal cydia openssh

For those users like myself who are technologically challenged, this post is designed to help them understand that an iphone 4.1 can indeed be connected to the mac via ssh over usb (e.g., even with wifi turned completely OFF, if so desired) (on a mac running osx 10.6.5 snow leopard). During the past couple of months, I must have read this thread a couple of times and left being confused because ssh via terminal is for advanced users. The terminal window that needs to be used to initially set this up is on the mac in the utilities folder (no need to use a terminal window on the iphone), and the user needs to execute the python string in the terminal window from within the folder ON THE MAC containing these files (tcprelay.py, usbmux.py, and usbmux.pyc) -- type this string into the terminal window:

python tcprelay.py -t 22:2222 &

Any sftp client for the mac will work (e.g., cyberduck, forklift, expandrive, etc.) -- the trick is to use the name localhost as the server name, and port 2222. The transfer speed is slightly faster than wifi. I hope this helps a lost soul like myself who thought there was no way to ssh over usb on the mac into an iPhone with semi-current firmware (i.e., 4.1). Of course, this requires openssh installed through cydia to work -- but nothing else extra from cydia is required that I am aware of based upon the current jailbreak that I used from greenpois0n.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.