This tutorial will talk you through generating a new SSH key in JuiceSSH and adding it to a server, to allow key based authentication.
- Create a new identity (or edit an existing one):
Press the set private key button. This will bring up a dialog allowing you to either import an existing private key, or generate a new one:
Choose the desired key length (we recommend 2048 bit).
We also recommend encrypting the key with a passphrase however this is optional.
- Click the 'Generate Snippet' button on the identity create/edit page
- SSH into the desired server. As your private key is not configured yet on the server, JuiceSSH will prompt for password authentication instead
- Once SSH'd in, long-press the terminal to show the context menu, and select Snippets:
- Select the snippet named 'Add Key: <your identity name>'
- The snippet will add your public key to the ~/.ssh/authorized_keys file and set the correct permissions
- Long-press the identity in the identity list and select the 'Export Public Key' item
- Save the public key to email/dropbox/whatever and transfer it to your server
- Run the following commands on the desired server to add it to your ~/.ssh/authorized_keys file:
mkdir -p ~/.ssh
chmod 700 ~/.ssh
echo "<your public key>" >> ~/.ssh/authorized_keys
chmod 600 ~/.ssh/authorized_keys