Friday, October 03, 2008

SSH to your iPhone without password

Previously I wrote about offline browsing which involves SSHFS that requires you type in the root password of your iPhone everytime. To save some typing, you could setup SSH public/private keys. Here are the steps.

On the host that you mount iPhone's filesystem, execute:
ssh-keygen -t rsa
which generates a public and a private key. The former is ~/.ssh/id_rsa.pub

On your iPhone
1) create a ~/.ssh directory and copy the above public key over. Name it as .ssh/authorized_key.
2) Uncomment the following line in your /etc/ssh/sshd_config:
AuthorizedKeysFile .ssh/authorized_keys

Now you could ssh (and thus sshfs) to your iPhone without password.

1 comment:

BL said...

Forgot to mention: OpenSSH may refuse connection if the permission of the key file and directory is not secure enough. If that's a problem, try this:

chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys