1). Generate a key on the Mac Terminal
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 xxxx@localhost.localdomain
In the process, you will be asked about your pass (passphrase) and enter your frequently used secret.
2). Create the. Ssh directory on the iPhone (the IP address of the iPhone is 10.0.2.2)
SSH root@10.0.2.2 'mkdir-P. Ssh'
If you ask your iPhone root password, enter Alpine.
3) copy the public key just generated to the iPhone
Cat ~ /. Ssh/id_rsa.pub | SSH root@10.0.2.2 'cat>. Ssh/authorized_keys'
If you ask your iPhone root password, enter Alpine.
4) edit the/etc/ssh/sshd_config file on the iPhone.
# Replace # strictmodes yes # pubkeyauthentication yes # authorizedkeysfile. Ssh/authorized_keys # With strictmodes nopubkeyauthentication yesauthorizedkeysfile. Ssh/authorized_keys
5). Restart the iPhone. OK!
By sschu