1

When setting up public key authentication on SimpleSSHD server on my Android phone, by http://www.galexander.org/software/simplesshd/

Quick start

  • Install SimpleSSHD.
  • On any computer which will connect to your Android device, set the port to 2222. With OpenSSH, this can be done by putting these lines in ~/.ssh/config:

    Host myphone
    Port 2222
    
  • Launch SimpleSSHD, and in Settings enable "Start on Boot", then manually start it for the first time.

  • Create authorized_keys in the home directory (do not use ssh-copy-id)
  • Optionally make .profile

how can I find out the hostname myphone for my android phone?

My phone is assigned different IP addresses from time to time. For example, I can move my laptop and phone to different LANs, and my phone can reconnect to the same LAN.

Some attempts from my laptop:

First attempt (fail):

$ ssh -p 2222 192.168.1.87
user@C6730:/data/data/org.galexander.sshd/files $ hostname
sh: hostname: not found

Second attempt (fail):

user@C6730:/data/data/org.galexander.sshd/files $ ^D
Connection to 192.168.1.87 closed.
t@ocean:/home/t$ ssh -p 2222 C6730
ssh: Could not resolve hostname c6730: No address associated with hostname

Third attempt (succeed with some luck by guessing):

I find all the hosts in the LAN by sudo nmap -sP 192.168.1.0/24, and guess which host in the output is most likely the phone. it is something like android-c0f659b6548c28b2 (not the real host name)

  • Will android-c0f659b6548c28b2 change under some cases, for example, when the phone is restarted, moved to a different LAN, assigned a different IP address, ...?

  • Does anyone know what c0f659b6548c28b2 means? It is not the Mac address of the phone.

  • Can I customize the hostname of the Android phone?

Thanks.

Tim
  • 485
  • 3
  • 10
  • 21

0 Answers0