On your phone,
install the F-Droid App Store app.
Reference(s):
On your phone,
enter the F-Droid App Store
by tapping on its app button.
From there,
install:
Enable Unexpected Keyboard
and configure Keyboard Switcher as you like.
Reference(s):
On your phone,
start Termux,
by tapping on its app button.
You will get a terminal interface.
Reference(s):
On your phone,
in the Termux interface,
if you haven't done yet,
enable the extra keys view by doing a long tap
on the keyboard button in the left drawer menu.
Reference(s):
On your phone,
in Termux,
do some initial tasks:
$ pkg update $ pkg upgrade $ pkg install openssh $ mkdir $HOME/.ssh
Reference(s):
On your phone,
in Termux,
generate host keys for sshd:
$ ssh-keygen -ANext give a password to your user:
$ passwd <password_of_your_choice>Then start the SSH server:
$ sshd
Reference(s):
MANDATORY:
Assure that your smartphone and your PC
are in the same network (WiFi).
Reference(s):
On your PC,
connect to your smartphone,
via SSH:
$ ssh <ip_of_your_smartphone> -p 8022
Reference(s):
Via SSH,
in Termux,
install the vital packages:
$ pkg install vim # or the text editor of your choice $ pkg install sshpass $ pkg install mosh $ pkg install htop # for testing purposes
Reference(s):
Via SSH,
in Termux,
create / add to file "$HOME/.termux/termux.properties":
extra-keys = [ \ [ \ { key: 'DRAWER' , popup: { macro: 'CTRL d' , display: 'C-d' } } , \ { key: 'ESC' , popup: { macro: 'CTRL c' , display: 'C-c' } } , \ { key: 'TAB' , popup: { key: 'b' , display: 'b' } } , \ { key: 'ALT' } , \ { key: 'LEFT' , popup: { key: 'F11' , display: 'F11' } } , \ { key: 'RIGHT' , popup: { key: 'F12' , display: 'F12' } } , \ { key: 'BACKSPACE' } , \ { key: 'PGUP' , display: 'PU' } , \ { key: 'HOME' , display: 'HOME' } , \ { key: 'RETURN' , popup: { key: 'q' , display: 'q' } } \ ] , \ [ \ { key: 'KEYBOARD' , popup: { macro: 'CTRL l' , display: 'C-l' } } , \ { key: '/' , display: '/' , popup: { key: 'BACKSLASH' , display: 'BKSL' } } , \ { key: 'r' , display: 'r' , popup: { key: 'R' , display: 'S-R' } } , \ { key: 'CTRL' , popup: { key: ',' , display: ',' } } , \ { key: 'UP' } , \ { key: 'DOWN' } , \ { key: 'SPACE' , display: '␣' } , \ { key: 'PGDN' , display: 'PD' } , \ { key: 'END' , display: 'END' } , \ { key: '#' , display: '#' , popup: { key: ':' , display: ':' } } \ ] , \ [ \ { key: '1' , display: '1' , popup: { key: 'F1' , display: 'F1' } } , \ { key: '2' , display: '2' , popup: { key: 'F2' , display: 'F2' } } , \ { key: '3' , display: '3' , popup: { key: 'F3' , display: 'F3' } } , \ { key: '4' , display: '4' , popup: { key: 'F4' , display: 'F4' } } , \ { key: '5' , display: '5' , popup: { key: 'F5' , display: 'F5' } } , \ { key: '6' , display: '6' , popup: { key: 'F6' , display: 'F6' } } , \ { key: '7' , display: '7' , popup: { key: 'F7' , display: 'F7' } } , \ { key: '8' , display: '8' , popup: { key: 'F8' , display: 'F8' } } , \ { key: '9' , display: '9' , popup: { key: 'F9' , display: 'F9' } } , \ { key: '0' , display: '0' , popup: { key: 'F10' , display: 'F10' } } \ ] \ ]
Reference(s):
Via SSH
in Termux,
reload the configuration files:
$ termux-reload-settings
Reference(s):
Via SSH,
in Termux,
create the directory that is scanned by the Termux widget:
$ mkdir $HOME/.shortcuts
Then create file "$HOME/.shortcuts/htop.sh":
#!/data/data/com.termux/files/usr/bin/bash htop
Reference(s):
On your phone,
create a Termux widget,
preferably on a new / empty "desktop".
In the Termux widget,
tap on the "reload" button, just in case.
Tapping on the "htop.sh" entry should open
a new Termux session with htop in it.
Reference(s):
On your PC,
transfer the tilde.town SSH key pair to your phone:
$ scp -P 8022 ~/.ssh/<tilde_town_ssh_key_file>* <ip_of_your_smartphone>:.ssh/
RECOMMENDATION:
Do not use the same SSH key pair on different devices.
For the use on your Android device, generate a separate SSH key pair.
Reference(s):
Via SSH,
in Termux,
set sane permissions for the SSH keys:
$ chmod 700 $HOME/.ssh $ chmod 600 $HOME/.ssh/*
Reference(s):
Via SSH,
in Termux,
create file "$HOME/.shortcuts/mosh_to_town.sh":
#!/data/data/com.termux/files/usr/bin/bash sshpass \ -v \ -P "Enter passphrase for key" \ -p "" \ mosh --ssh='ssh -i ~/.ssh/<tilde_town_ssh_key_file>' <your_login_name>@tilde.town
WARNING:
While the mosh/ssh connection is running,
the ssh key password, as part of the command line,
is visible to the ps command.
To prevent this, sshpass can also read a password
from a file when the -f flag is passed.
The file storing the password should have secure permissions.
Reference(s):
In the Termux widget,
hit the "reload" button.
Then hitting the "mosh_to_town.sh" entry should open
a new Termux session which connects to tilde.town
without the need of typing the password.
Reference(s):
Reference(s):