davidlane.io

Teaching and learning Russian and English

SSH + Termux: Dealing with random Android Hotspot IP addresses

The problem: I connect to Termux on my Android phone from my iPad with Blink shell, but am asked to verify the host key every time I connect, because my phone sets a random IP each time.

E.g. first it's 192.168.43.23, then 192.168.43.180.

My (partial) solution: disable host key checking for my Android hotspot's subnet in Blink.

In Blink shell, create a file "config" in .ssh/ with these contents (change the subnet to match yours if it differs):

Host 192.168.43.*
StrictHostKeyChecking no
UserKnownHostsFile=/dev/null

I edited the file in vim and then copied it into Blink's folder using Apple's Files, then moved it into .ssh/ from within Blink.

(Thanks to https://www.shellhacks.com/disable-ssh-host-key-checking/ for the solution)

You'll no longer be asked to verify the host key every time you connect to Termux. Horray!