1). 在Mac的终端上产生密匙
ssh-keygen -t rsaGenerating public/private rsa key pair.Enter file in which to save the key (/home/xxxx/.ssh/id_rsa):Created directory '/home/xxxx/.ssh'.Enter passphrase (empty for no passphrase): xxxEnter same passphrase again: xxxYour identification has been saved in /home/xxxx/.ssh/id_rsa.Your public key has been saved in /home/xxxx/.ssh/id_rsa.pub.The key fingerprint is:e4:e8:b7:05:06:b3:f0:ff:af:13:fc:50:6a:5b:d1:b5过程中会提问你通行证(passphrase),输入你常用的秘密。
2). 在 iPhone 上创建.ssh目录(iPhone的IP地址是10.0.2.2)
ssh root@10.0.2.2 'mkdir -p .ssh'如果问道你iPhone root password,输入 alpine。
3). 拷贝刚才生成的公开密匙到 iPhone
cat ~/.ssh/id_rsa.pub | ssh root@10.0.2.2 'cat >> .ssh/authorized_keys'如果问道你iPhone root password,输入 alpine。
4). 在 iPhone 上编辑 /etc/ssh/sshd_config 文件
#将#StrictModes yes#PubkeyAuthentication yes#AuthorizedKeysFile .ssh/authorized_keys#替换为StrictModes noPubkeyAuthentication yesAuthorizedKeysFile .ssh/authorized_keys
5). 重新启动iPhone,OK!
by sschu