O’s World

努力!奋斗!

在 iOS 设备上安装和使用 OpenSSH

| 评论

什么是 OpenSSH

OpenSSH 是一个在 Linux 下很实用的一个软件。iPhone 本身就是一个运行 BSD 系统(可认为是一种 Liunx)的硬件,因此,Cydia 的作者 Saurik 把 OpenSSH 这一软件移植到了 iOS 平台上,并且简化了安全认证密钥的繁琐,使之成为一款可以在 iPhone 上运行的 Cydia 软件。

OpenSSH 的用途

OpenSSH 可以让你在 PC 或者 Mac 上远程输入命令操作 iOS 设备,免去使用 MobileTerminal 的不方便,同时,也是一种在多系统下管理 iPhone、iPad 系统文件的方法。

安装和使用 OpenSSH

要安装 OpenSSH 首先需要将设备越狱。越狱完成之后,就可以在 Cydia 中直接查找和安装 OpenSSH。安装完成之后就可以通过下面的步骤来将你的 Mac 连接到 iOS 设备。

  1. 首先得保证你的 iOS 设备和 Mac 在同一局域网的同一网段中。
  2. 打开终端,输入 ssh root@192.168.xxx.xxx
  3. 输入 iOS 设备密码,默认 alpine
  4. 等待连接,稍后,您就连接到您的iPhone、iPad上,可以执行 Unix 命令了。
  5. 还可以使用 Transmit 等软件来管理 iOS 设备的文件系统,非常方便。

可能出现的问题

如果之前使用 Mac 终端连接过 iOS 设备,然后设备被还原,重新越狱,安装 OpenSSH。再次使用 终端连接 iOS 设备的时候会出现如下错误:

1
2
3
4
5
6
7
8
9
10
11
12
13
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
a3:63:1f:45:ed:91:3e:67:e3:d0:37:83:dd:24:83:f6.
Please contact your system administrator.
Add correct host key in /Users/orinchen/.ssh/known_hosts to get rid of this message.
Offending RSA key in /Users/orinchen/.ssh/known_hosts:10
RSA host key for 192.168.xxx.xxx has changed and you have requested strict checking.
Host key verification failed.

解决方法是,使用编辑器打开 ~/.ssh/known_hosts 文件,删除 192.168.xxx.xxx 的相关 rsa的信息即可.