I'm using an SFTP server app on my Android phone (RedMi 3S); it's a typical Android app, not something requiring root or run as an ARM binary from the command-line). This server app lets me define some username+password combinations for connecting. So far - so good.

Now, I want to use some public keys to allow password-less connection from certain people/hosts. But - where should I put them? What's the equivalent of the faux-user's $HOME/.ssh directory?

I realize I can just put them anywhere and it'll work, I'm asking what's the customary location for this kind of data.

  • Are you using some Android app to run server or running from commandline? If it's app, which app? If using commandline, from where did you get the binaries? Are they standard Linux binaries or modified for Android? – Irfan Latif Jan 29 at 12:02
  • If the SFTP app is well designed it would allow you to import the user public keys into it's app private directory below /data/data. That IMHO best place where such file(s) should be stored. – Robert Jan 29 at 19:13
  • @IrfanLatif: Using an app. See edit. – einpoklum Jan 29 at 21:21
  • 1
    @einpoklum then best is what @Robert suggested. /data/data/<pkg_name> is a kind of HOME for Android apps because every app is a UNIX user and there is no /home on Android. /data/data/<pkg_name> is the most secure place because other apps can't access that directory. However if your app doesn't have option to import key, then you'll have to use /sdcard obviously. Termux also has a sshd server package and it uses /data/data/com.termux/files/home as $HOME. – Irfan Latif Jan 30 at 14:01
  • @IrfanLatif: I don't have a folder named /data. At least - not that I can see, as a non-root user. – einpoklum Jan 31 at 11:52

Your Answer

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

Browse other questions tagged or ask your own question.