2009-07-03

My iPhone iSSH set up

Since my Psion Revo I've had terminal (later SSH) applications on my phones, just so I can access any server I might need to from anywhere. It's a very comforting thing to have, knowing that if there's a problem you can fix it.
I'm happy to say that the iPhone experience is better than any other mobile SSH solution I've ever used. This is thanks to the iPhone's UI and Dean Beeler of Zingersoft and the iSSH application. I've not tried other SSH apps for the iPhone as I'm very happy with Dean's efforts. He's also very active on the Google Group for iSSH. He's also (slightly reluctantly) dishing out AdHoc releases when the approval process of the AppStore is slow. Excellent!
This post pertains to iSSH 3.1, and I know it will probably be short-lived as Dean has already submitted 3.5 to Apple AppStore as I type this. It also is only about how to set up your connections, I'm not very versed in the advanced use (yet?).
Let's get started.
I wanted easy connection to my servers, and my passwords are tedious things, so typing them, even on a normal keyboard, is no fun, let alone the iPhone's keyboard. iSSH has got the option to store the password, and I think that's a good idea, but I find it safer to use the RSA key functionality. The reason for this is quite simple; Should I lose my iPhone I can log onto the servers and delete the keys from anywhere. I can't blank the passwords remotely. To add a bit of protection onto this "blanket log in", I use the "Passcode Lock" feature. This is simply a 4 digit PIN (personal identification number). If you don't know the PIN, you're locked out of the app.
Short config is thus;
  • Passcode (PIN) lock
  • RSA key pair for login
  • Never log in as root (Super User)
Simple enough!
Here's how to do it.
  1. Turn on "Passcode Lock" - Go into "General Settings". Flick on the "Passcode Lock" switch.
  2. Generate your key, RSA key in my case, by clicking the "Generate" under "RSA Key Functions".
  3. Create a new connection by clicking "Add Configuration".
  4. Enter your details as you would with these notes.
  5. This is optional; Use "screen -DRRS iphone" in the Command setting. This starts a screen session automatically or reconnects to an existing one. This enables you to shut down your iSSH application without losing anything from the terminal. Thanks to a lot of guys on the Google Group, and Jared Earle in particular for his "SSH on the iPhone at last" post.
  6. Then enter your password in as usual.
  7. Click "Save" at the top of the screen. This step shouldn't be necessary, but I found the app giving some error messages once. I'm sure Dean will fix it.
  8. Go back into your newly created connection and then click "Transfer Public RSA Key". This will copy the public key into your ~/.ssh/authorized_keys file. If you don't have the file, you need to create it; mkdir ~/.ssh && touch ~/.ssh/authorized_keys && chmod -R 700 ~/.ssh before you transfer the key.
  9. Once the key is successfully transferred, flick the "Use RSA Key" switch on. This switches from using your password to using the key.
  10. Click "Save" at the top of the screen.
  11. Test your new setting. You will be asked to confirm the host's certificate. (Note that you'll need to confirm the certificate every time you change the setting - I was almost getting annoyed with this until I figured it out).
What should happen when you connect is that you shouldn't have to enter a password, but you should be logged straight into the server and swished straight into a screen session.
Separately these steps aren't difficult, but figuring out the sequence took a bit of time for me, so hope this saves you a bit of time.
I've now got all my important connections on the phone. The useability of the iPhone iSSH application is just astonishing for such a small device. Screen swiping, pinch zoom, gestures, horizontal mode, etc, etc all make it surprisingly easy to control your server.

No comments: