普通方式不行。这里用的是:https://www.jianshu.com/p/ec2bc3061632
先安装usbmuxd
brew install usbmuxd
然后端口转发
iproxy 4567 22
然后就能连接了 前提是打开了通道
ssh -p 4567 root@127.0.0.1
密码手机默认密码
记得修改密码 不然谁都可以连接
192:~ haidragon$ ssh -p 4567 root@127.0.0.1
The authenticity of host '[127.0.0.1]:4567 ([127.0.0.1]:4567)' can't be established.
ECDSA key fingerprint is SHA256:h3JADtiqE+XlUJzzrtOj0Z9FRto1+Yl4H+8m0jzgI8I.
Are you sure you want to continue connecting (yes/no)? y
Please type 'yes' or 'no': yes
Warning: Permanently added '[127.0.0.1]:4567' (ECDSA) to the list of known hosts.
root@127.0.0.1's password:
Permission denied, please try again.
root@127.0.0.1's password:
iPhone:~ root# ls
Application Support Library Media
iPhone:~ root# cd /
iPhone:/ root# ls
Applications Library User boot dev lib private tmp var
Developer System bin cores etc mnt sbin usr
iPhone:/ root# exit
logout
Connection to 127.0.0.1 closed.
192:~ haidragon$ ssh root@127.0.0.1
ssh: connect to host 127.0.0.1 port 22: Connection refused
192:~ haidragon$ ssh -p 4567 root@127.0.0.1
root@127.0.0.1's password:
iPhone:~ root# cd /
iPhone:/ root# ls
Applications Library User boot dev lib private tmp var
Developer System bin cores etc mnt sbin usr
iPhone:/ root# passwd
Changing password for root.
New password:
Retype new password:
iPhone:/ root# exit
logout
Connection to 127.0.0.1 closed.
192:~ haidragon$ ssh -p 4567 root@127.0.0.1
root@127.0.0.1's password:
iPhone:~ root#