(I'm not sure if this better belongs on unix.se or android.se, but since it's primarily security-related, I'm asking it here)

I use my Android device to access servers for quick on-the-go administration. Before you ask, the device is encrypted with a fairly strong passphrase.

I'm using the standard Terminal Emulator provided by CyanogenMod. This provides me a simple Bash shell prompt where I can then ssh into the servers I'd like.

I'm running into a couple problems and security pitfalls:

  1. The application runs as user u0_a24, but the Dropbear SSH home is set to /data/.ssh. This means that unless I'm root, I can't access the files without making them publicly available: bad.
  2. If I just store my private key on my (albeit) encrypted sd card, other apps would probably be able to get access to it. I've made my private key fairly strong (lots of iterations of PBKDF2 in PKCS8), but still, I'm not interested in other apps getting access to it.

What's the recommended way of handling this? Has anyone had any luck with doing this on Android?

3 Answers 3


Alternatively, you might consider the JuiceSSH client. It stores your keys in its private app directory. In addition, it encrypts its storage so even jailbroken phones offer some level of protection.

- @JuiceSSH: "External storage won't work as keys are imported into the internal JuiceSSH database".
- @JuiceSSH: "They [ssh keys] are stored in an encrypted SQL database, but you can export them by long-pressing on the identity".


I found a way to get the best of both worlds.

rm /data/.ssh
mkdir /data/data/jackpal.androidterm/app_HOME/.ssh
chown u0_a100:u0_a100 /data/data/jackpal.androidterm/app_HOME/.ssh
mv /storage/sdcard0/id_rsa /data/.ssh/id_rsa
touch /data/.ssh/{config,known_hosts}

In this way, only the app user can get access to the private key, no other user has access to it.


Option 1 will probably get you the best security. If you move anything to your SD card it's free game for other apps by default. Using the SU app you can (an should) define rules about when you give an app SU permissions, including time limits, this let's you be more granular in your access.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .