This site WAS hosted on an old Pantech Flex P8010 smartphone.

By Jonathan Johnston

Posted on August 11, 2022

My experience setting up my first local server using Tiny Server. Outlines roadmap for learning web servers and programming, including my goal of pursuing Ethereum-based smart contract programming. The post also provides instructions for setting up SSH access and authorized keys for passwordless login.

This is the first local server I setup, that will help me learn about webservers and programming. This server is running Tiny Server.

The goal is to have a job doing eth based smart contract programming by the end of the year.

The roadmap currently is:

I did run into some hurdles in trying to get SSH running from the phone to administer the page. To keep it simple, I used SimpleSSHD.

Theres usually no password for Android phones. The screenlock isn't a password, and its usually a pin, pattern, face or fingerprint ID.

Instead, SimpleSSHD creates a temporary password, but you don't want to always be looking at the phone to login, defeats a lot of the benefit of SSH. So my second issue was setting up authorized keys. With authorized keys, no password entry is required.

SSH uses public/private key pairs to secure the connection, so you want to to generate public/private key pairs and then put them in a file AUTHORIZED_KEYS on the host computer, in the directory the SSH server will be looking for. For SimpleSSHD that directory is,

/data/data/org.galexander.sshd/files

The recommended way of producing public/private keypairs in Windows 10 is ssh-keygen, which before solving my first hurdle, I ran into my second.

There are a lot a complicated options to go with when you create your keys, being a first timer at this, I wanted to keep it simple. I just used "ssh-keygen", with no options, so it uses defaults. Generally you want to generate these keys in the /.ssh directory which is probably at,

C:\users\%USERNAME%\.ssh\

It seems its sometimes an issue, that on PowerShell, ssh-keygen without any options, freezes when it asks you for the file pathname and password. I had to force close PowerShell.

So, the preferred method to get around this, is to use the options modifiers to state the file pathname and password in the command, so it never asks you, and so apparently it never freezes. That wasn't the option I went with, so I don't have that command for you. I just opened a Cmd Terminal and did it there, reportedly after you run it once it fixes the freezing problems with ssh-keygen in PowerShell, but I haven't tried it again yet.

The result is the private key file, id_rsa and the public key file id_rsa.pub you want to get the public key file id_rsa.pub into a file AUTHORIZED_KEYS on the host computer.

I couldn't figure out how to use secure copy scp with the temporary password SimpleSSHD provides. It doesn't provide the the temporary password till after you enter the compand, but scp never prompts for a password. I couldn't figure out if there was a way to do the authorization first, except for keypairs, this is what I did instead. (Copied from somewhere else, I don't remember where.)

Open the id_rsa.pub file in notepad, or type cat id_rsa.pub in PowerShell, from the ./ssh/ directory, and copy the contents.

SSH'd into the phone,

ssh 192.168.0.x -p 2222 {username}@192.168.0.x's password: user@android:/data/data/org.galexander.sshd/files

The IP is going to be your phone IP which is right at the top when you start SimpleSSHD, something like 192.168.0.7 and the {username} is actually your windows username. That threw me off a little, but you generally don't have a username on Android, so I guess it defaults to assuming the username is the same.

By default it should pop you into the directory you want to be in. Then,

echo "{paste contents of id_rsa.pub here}" > authorized_keys

Close the connection, now when you SSH in again, it won't ask you for a password, unless you opted for a password on the keyfile, in which case, use that password you created, which is of course proper security, but you may or may not do as a first timer keeping things simple.

Hope this helps.