Ssh通过usb连接失败

执行命令$ ssh root@localhost -p 6666结果如下:
ssh_exchange_identification: Connection closed by remote host
使用OSX 10.11系统

你下载个pp助手 直接用pp助手那个打开ssh就行了。。简单好用

没有端口转发吧?

  • 1)在终端A执行命令:
    $ /Users/coohua/Code/tcprelay.py -t 12345:6666 Forwarding local port 6666 to remote port 12345

  • 2)新建终端B,并ssh转到手机执行命令:
    $ ssh root@localhost -p 6666 ssh_exchange_identification: Connection closed by remote host
    远程主机关闭???,这时在A端口打印:
    Incoming connection to 6666 Waiting for devices... Connecting to device <MuxDevice: ID 2 ProdID 0x12a0 Serial 'c4f1dd6f64d2eec8ee661c697d7b93cd7f82073b' Location 0x14100000> Exception happened during processing of request from ('127.0.0.1', 62930) Traceback (most recent call last): File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 599, in process_request_thread self.finish_request(request, client_address) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 334, in finish_request self.RequestHandlerClass(request, client_address, self) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 655, in __init__ self.handle() File "/Users/coohua/Code/tcprelay.py", line 82, in handle dsock = mux.connect(dev, self.server.rport) File "/Users/coohua/Code/usbmux.py", line 235, in connect return connector.connect(device, port) File "/Users/coohua/Code/usbmux.py", line 206, in connect raise MuxError("Connect failed: error %d"%ret) MuxError: Connect failed: error 3

ssh命令默认使用22端口,而你的操作是把本地6666端口转发到远程12345端口,跟22端口没关系了。
改成/Users/coohua/Code/tcprelay.py -t 22:6666就可以了

原来是这样,我觉得应该在书中说明一下,不然很多人会搞错
我还感觉1024以内的端口最好不用,然后才用的12345

根据你编辑后的,终于可以了:http://iosre.com/t/usb-ssh-ios/193
搞了一周啊 眼泪哗哗的、、、

我执行 这条指令时。 ssh root@localhost -p 12345 时 报错。ssh_exchange_identification: Connection closed by remote host