After setting up Cloudflared on Termux, we can now SSH into the phone that has Termux installed.
-
Create a Public Hostname,
ssh.example.com
, with the following properties:a. Service type:
SSH
b. URL:
127.0.0.1:8022
-
In Cloudflared Access, go to Applications and create a new one, with the following properties:
a. Application name (can be anything): ssh
b. Public host name:
ssh.example.com
c. Add access policy allow your own email.
d. Browser rendering settings:
SSH
- Install openssh:
pkg upgrade
pkg install openssh
- Start server by issuing:
sshd
- Use the service via:
sv up sshd
sv-enable sshd
- If you need to stop
sshd
, just kill it's process:
pkill sshd
- Know your username via:
whoami
Create a new password with passwd
$ passwd
New password:
Retype new password:
New password was successfully set.
From your PC, copy the public key, if already generated, else see Generating a new SSH key
For e.g.
cat .ssh/id_ed25519.pub
and paste it in Termux:
nano .ssh/authorized_keys
-
Visit
ssh.example.com
-
Access application via your email
-
Enter your username, of the type:
u0_a264
-
Either type in your password or paste your private key
-
Profit!