get unstuck, in time

09 August 2008

Tip: ssh autologin on the iPhone

If you have a jailbroken iPhone or iPod Touch and an inclination to hack and/or just poke around, you've probably ssh'ed into it as root (the password, if you haven't reset it, is "alpine"). Oh, the heady rush the first time I saw that shell hash prompt. Anyway, after getting highly skilled in quickly typing "alpine" (muscle memory is a beautiful thing) it occurred to me I could eliminate that step by using ssh's autologin feature. Because it configures the session setup aspect of secure communication, it also applies to other secure connections you might make to the iPhone, like those via scp. And really, if you've got ssh and scp, what else do you need? There are plenty of howtos out there that go into a lot of detail on the subject, but the basics are: On your PC: 1. Run ssh-keygen from the command line. This will generate a public key and put in your home directory in a hidden subdirectory named.ssh. 2. Go to your .ssh directory and scp your file to your iPhone. 3. ssh to your iPhone. On your iPhone 4. Create a ~/.ssh directory and set its mode to 0700. 5. Move the file you copied over to ~/.ssh/authorized_keys. Voila, no more alpine. You can repeat the process from more PCs by appending each public key file to the authorized keys file (i.e. cat >> .ssh/authorized_keys). Note that this doesn't actually disable you or others from logging in to your iPhone if you or they know the root password, and in any case you might want to consider changing it (in the usual way, with the passwd command).



Post a Comment

<< Home

Copyright (C) 2001-2008