免密ssh登录越狱的iPhone手机
电脑端生成rsa密钥对ssh-keygen -t rsa -P , -P 表明密钥的密码为空
~ ssh-keygen -t rsa -P
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/dh/.ssh/id_rsa): /Users/dh/.ssh/id_rsa_13)
Your identification has been saved in /Users/dh/.ssh/id_rsa_13
Your public key has been saved in /Users/dh/.ssh/id_rsa_13.pub
上传公钥到手机
先连接手机终端,执行ssh-keygen,使手机自动生成.ssh文件夹,可见Dopamine越狱的手机路径在/var/jb/var/mobile/.ssh/
iPhone-13-mini:~ mobile% ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/var/jb/var/mobile/.ssh/id_rsa):
Created directory /var/jb/var/mobile/.ssh .
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /var/jb/var/mobile/.ssh/id_rsa
Your public key has been saved in /var/jb/var/mobile/.ssh/id_rsa.pub
上传公钥
执行ssh-copy-id -i /Users/dh/.ssh/id_rsa_13.pub mobile@192.168.1.147上传公钥文件到/var/jb/var/mobile/.ssh/authorized_keys,或者scp -P2222 /Users/dh/.ssh/id_rsa_13.pub mobile@192.168.1.147:/var/jb/var/mobile/.ssh/authorized_keys
使手机当前用户mobile和.ssh文件夹的权限是700, .ssh目录下的authorized_keys文件需要600或644权限
chmod 700 mobile
chmod 700 .ssh
chmod 600 authorized_keys
目前电脑端就可以使用如下命令免密登录了
$ ssh -i /Users/dh/.ssh/id_rsa_13 mobile@192.168.1.147
电脑端配置config,使命令更简洁,在/Users/dh/.ssh/下新建文件config,内容如下
Host 13mini
Hostname 127.0.0.1
User mobile
Port 2223
IdentityFile ~/.ssh/id_rsa_13
Host 666s
Hostname 127.0.0.1
User root
Port 2222
IdentityFile ~/.ssh/id_rsa_666s
这样就可以使用ssh 13mini免密登录iPhone13mini手机,ssh 666s免密登录iPhone6s手机了
© 版权声明
文章版权归作者所有,未经允许请勿转载。
相关文章
暂无评论...