SSH Login Without Password

If you frequently connect your phone to a particular computer (for example, your home computer), you will want to login to your phone without password. Passwordless login makes the docking features seamless.

With one command, "phone-dock usb dock", the files on your phone will appear in your $HOME directory (via SSHFS) and your phone's LXpanel will appear on your desktop's computer screen.

But first, we need passwordless login.

The docking features run much more smoothly when the phone is connected via USB (as opposed to wirelessly), so let's first use ADB to forward the SSH port.

c$ adb forward tcp:5022 tcp:22

Next, we'll test the connection by logging in the usual way:

c$ ssh -p 5022 soul@127.0.0.1

soul@127.0.0.1's password:

<...>

d$ whoami

After logging into your phone, create a $HOME/.ssh directory for the authentication key from your desktop computer:

d$ mkdir $HOME/.ssh

d$ exit

Next, the desktop computer needs a pair of authentication keys, a private one and a public one (for the phone). Do not enter a passphrase:

c$ ssh-keygen -t rsa

Finally, we append the desktop computer's public key to the phone's list of authorized keys:

c$ cat $HOME/.ssh/id_rsa.pub | ssh -p 5022 soul@127.0.0.1 'cat >> $HOME/.ssh/authorized_keys'

And from now on, we can login to the phone from the desktop computer without password:

c$ ssh -p 5022 soul@127.0.0.1

<...>

d$ whoami

Copyright © 2014-2024 Eryk Wdowiak