This blog has moved!

Please follow the twenty08 blog on tumblr! We'll have new updates on MobileChat, QuickShareIt, and other products there!

http://tumblr.twenty08.com

Step by Step: Public Key Authentication on the iPhone


It’s assumed you have OpenSSH and the BSD Subsystem installed via Installer.app or whatever else..

I’m also assuming you use a Mac or Linux, Windows guys, it’s really not that much harder just look up a tutorial on how to create a public key with PuTTy

Open Terminal on your Machine (not logged into the iPhone) run these commands:
$ ssh-keygen -t dsa
$ scp ~/.ssh/id_dsa.pub root@**YOUR_IPHONE_IP**:/tmp

Now SSH into your iPhone..

If you haven’t already created the .ssh directory, do so by doing this:
$ mkdir -p /var/root/.ssh/

If you have already tried to do this, I’m going to suggest clearing out the authorized_keys file to prevent any complications
$ rm /var/root/.ssh/authorized_keys

And now, run the following commands:
$ cat /tmp/id_dsa.pub >> ~/.ssh/authorized_keys
$ chmod 0755 /var/root/.ssh/authorized_keys
$ chmod 0755 /var/root/.ssh
$ chmod 0755 /var/root
$ exit

You should hopefully be able to login now without requiring a password.. let me know your results!

Note: The chmod to 0755 is very important, and won’t work if the permissions are not setup correctly.

Update: I fixed all the commands, they should work for everyone now

Information and Links

Join the fray by commenting, tracking what others have to say, or linking to it from your blog.



Other Posts
MobileChat v2.0b Released!
A Big Thank You!

Reader Comments

Checking out this app, but i don’t haev an iphone. I am a linux user who uses a dock called awn on my computer. Read abotu it on my blog, if your not sure what it is. I want to knnow if it would be possible to use this in the ubuntu linnux enviroment to creat a plugin for our dock?

It is not working for me. SSH still asks for a password (after saying PEM_read_Privatekey failed). Apparently it needs the password to decode the private key?

Any help would be appreciated.

Thanks.