I'm connecting from my Android handset to my NAS, using SSH. The private key was generated on my PC and then placed in the sd card folder of the phone. So I'm using the identity flag to tell ssh where to find the key file, so
ssh -i /storage/sdcard/key -p 1000 [email protected]
Every time I try to connect I get the message that "the authenticity of host can't be established". So I am asked whether I want to continue connecting and I have to manually say "yes" every time.
For some the host cannot be added to known_hosts and so I get asked every time to confirm manually. I tried to find ".ssh" on my device but I can't find it.
Failed to add the host to the list of known hosts (/data/.ssh/known_hosts)
Can someone please help?
Thanks.
EDIT: I have manually created /data/.ssh/known_hosts but the problem persists
/data/.ssh
and the file/data/.ssh/known_hosts
to ensure your SSH app can access the directory and write to the file?/data/.ssh
will not be very good. Either you set minimal permissions and it will work only in one context (e.g. adb shell, one terminal emulator, one tunnel application) or you set broad permissions and any application will be able to read and write yourknown_hosts
which is a security risk. A real solution would be to tell ssh to use a different directory depending on the calling context. I tried environment variablesHOME
andANDROID_DATA
, fail so far.