安装 ssh 的公开密匙到 iPhone 上
2012-10-25 19:35
274 查看
1).在Mac的终端上产生密匙
ssh-keygen-trsa Generatingpublic/privatersakeypair. Enterfileinwhichtosavethekey(/home/xxxx/.ssh/id_rsa): Createddirectory'/home/xxxx/.ssh'. Enterpassphrase(emptyfornopassphrase):xxx Entersamepassphraseagain:xxx Youridentificationhasbeensavedin/home/xxxx/.ssh/id_rsa. Yourpublickeyhasbeensavedin/home/xxxx/.ssh/id_rsa.pub. Thekeyfingerprintis: e4:e8:b7:05:06:b3:f0:ff:af:13:fc:50:6a:5b:d1:b5xxxx@localhost.localdomain
过程中会提问你通行证(passphrase),输入你常用的秘密。
2).在iPhone上创建.ssh目录(iPhone的IP地址是10.0.2.2)
sshroot@10.0.2.2'mkdir-p.ssh'
如果问道你iPhonerootpassword,输入alpine。
3).拷贝刚才生成的公开密匙到iPhone
cat~/.ssh/id_rsa.pub|sshroot@10.0.2.2'cat>>.ssh/authorized_keys'
如果问道你iPhonerootpassword,输入alpine。
4).在iPhone上编辑/etc/ssh/sshd_config文件
#将
#StrictModesyes
#PubkeyAuthenticationyes
#AuthorizedKeysFile.ssh/authorized_keys
#替换为
StrictModesno
PubkeyAuthenticationyes
AuthorizedKeysFile.ssh/authorized_keys
5).重新启动iPhone,OK!
bysschu