Difference between revisions of "SSH Over USB"

From iPhone Development Wiki
Jump to: navigation, search
(SSH over USB using usbmuxd: add section Making itunnel mux run automatically in the background on OS X)
(SSH over USB using usbmuxd)
Line 3: Line 3:
 
== SSH over USB using usbmuxd ==
 
== SSH over USB using usbmuxd ==
  
=== With Python ===
+
You can either download a binary and run that or use a python script. The python script is a lot slower than the binary version.
  
Tested on OS X and Windows.
+
=== Using binary ===
 
 
You will need to have Python installed on your system.
 
 
 
* Get [http://marcansoft.com/blog/iphonelinux/usbmuxd/ usbmuxd] source package and unpack. (Or if the linked usbmuxd package doesn't work, try [http://cgit.sukimashita.com/libusbmuxd.git/ libusbmuxd].)
 
* Go into folder python-client
 
* chmod +x tcprelay.py
 
* Run ./tcprelay.py -t 22:2222
 
 
 
Now you can log into your device via ssh mobile@localhost -p 2222
 
 
 
The -t switch tells tcprelay to run threaded and allow more than one ssh over the same port.
 
 
 
See ./tcprelay.py --help for further options.
 
 
 
=== Without Python ===
 
  
 
* Download the zip file from [https://code.google.com/p/iphonetunnel-usbmuxconnectbyport/downloads/detail?name=itnl_rev8.zip OS X] or [https://code.google.com/p/iphonetunnel-usbmuxconnectbyport/downloads/detail?name=itunnel_mux_rev71.zip Windows (32 bits)].
 
* Download the zip file from [https://code.google.com/p/iphonetunnel-usbmuxconnectbyport/downloads/detail?name=itnl_rev8.zip OS X] or [https://code.google.com/p/iphonetunnel-usbmuxconnectbyport/downloads/detail?name=itunnel_mux_rev71.zip Windows (32 bits)].
Line 58: Line 43:
 
* run <code>sudo launchctl load /Library/LaunchDaemons/com.usbmux.itunnel.plist</code>
 
* run <code>sudo launchctl load /Library/LaunchDaemons/com.usbmux.itunnel.plist</code>
 
* You now don't have to run the itunnel binary every time you want to SSH over USB as the itunnel software is always running in the background
 
* You now don't have to run the itunnel binary every time you want to SSH over USB as the itunnel software is always running in the background
 +
 +
=== Using python ===
 +
 +
Tested on OS X and Windows.
 +
 +
You will need to have Python installed on your system.
 +
 +
* Get [http://marcansoft.com/blog/iphonelinux/usbmuxd/ usbmuxd] source package and unpack. (Or if the linked usbmuxd package doesn't work, try [http://cgit.sukimashita.com/libusbmuxd.git/ libusbmuxd].)
 +
* Go into folder python-client
 +
* chmod +x tcprelay.py
 +
* Run ./tcprelay.py -t 22:2222
 +
 +
Now you can log into your device via ssh mobile@localhost -p 2222
 +
 +
The -t switch tells tcprelay to run threaded and allow more than one ssh over the same port.
 +
 +
See ./tcprelay.py --help for further options.
  
 
== SSH over USB using the iFunBox GUI (Windows only) ==
 
== SSH over USB using the iFunBox GUI (Windows only) ==

Revision as of 21:39, 25 October 2014

Languages: English • françaisไทย

SSH over USB using usbmuxd

You can either download a binary and run that or use a python script. The python script is a lot slower than the binary version.

Using binary

  • Download the zip file from OS X or Windows (32 bits).
  • Unzip to a directory of choice.
    • Windows: Run path/to/itunnel_mux.exe --iport 22 --lport 2222
    • OS X: Run sudo path/to/itnl --iport 22 --lport 2222

Connect to localhost as you would over wifi.

Making itunnel mux run automatically in the background on OS X

  • Save the unzipped folder (containing both itnl and libmd.dylib) somewhere (eg. /Library/itunnel)
  • Create the file /Library/LaunchDaemons/com.usbmux.itunnel.plist with the contents:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>Label</key>
	<string>com.usbmux.itunnel</string>
	<key>ProgramArguments</key>
	<array>
		<string>/path/to/itnl</string>
		<string>--iport</string>
		<string>22</string>
		<string>--lport</string>
		<string>2222</string>
	</array>
	<key>RunAtLoad</key>
	<true/>
	<key>OnDemand</key>
	<false/>
</dict>
</plist>
  • (replacing /path/to/ with the path to where you have itnl stored, eg. /Library/itunnel/)
  • run sudo launchctl load /Library/LaunchDaemons/com.usbmux.itunnel.plist
  • You now don't have to run the itunnel binary every time you want to SSH over USB as the itunnel software is always running in the background

Using python

Tested on OS X and Windows.

You will need to have Python installed on your system.

  • Get usbmuxd source package and unpack. (Or if the linked usbmuxd package doesn't work, try libusbmuxd.)
  • Go into folder python-client
  • chmod +x tcprelay.py
  • Run ./tcprelay.py -t 22:2222

Now you can log into your device via ssh mobile@localhost -p 2222

The -t switch tells tcprelay to run threaded and allow more than one ssh over the same port.

See ./tcprelay.py --help for further options.

SSH over USB using the iFunBox GUI (Windows only)

This feature only exists in the Windows build of iFunBox.

  • Get the latest Windows build of iFunBox and install it.
  • Click on "Quick Toolbox," then "USB Tunnel."
  • Assign ports as you see fit.

Theos usage

Export the following variables in your shell in order to deploy builds to the connected device:

export THEOS_DEVICE_IP = 127.0.0.1

export THEOS_DEVICE_PORT = 2222