When I try using Terminal emulator's ssh I get

ssh: Warning: failed creating /data/.ssh: Permission denied.

or since 2012-08-19:

Could not create directory '/data/ssh_client'.

But when I type:

echo $HOME

Why isn't ssh checking /sdcard/.ssh or /sdcard/ssh_data?

  • 3
    That is a question you should ask the author of the terminal emulator app. – Robert Dec 21 '11 at 9:11
  • @Robert: Good suggestion, I will try that :-) – Dan Dec 21 '11 at 18:57
  • Added source link and info... I find this question legitimate, btw. See my answer... – ce4 Aug 31 '12 at 8:08

This doesn't happen when you run ssh as root.

/sdcard is an unsafe(!) location for ssh client config and valuable keys (some users don't even encrypt their keys for reasons of laziness). Each app has read access to that location, so this is most probably set deliberately not to /sdcard/.ssh for security reasons.

If you have root access, create a symlink from /data/ssh_data or /data/.ssh to /data/jackpal.androidterm/ or create the folder with appropriate access rights for the terminal app (not system wide read/write though!).

By the way:
This might be fixed soon. See CyanogenMod's github commit log here. Excerpt:

Some users have / as home directory, some /data. This commit fixes ssh and ssh-keygen trying to create /.ssh which is volatile and read-only anyway.

To allow an app (e.g. Android Terminal Emulator) to use ssh /data/ssh_client still has to exist and owner permissions need to be set to the app user. This could be fixed by using the real data directory (/data/data/"app") in a later commit.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.