Termux in Google play store is outdated and to get the latest version of Termux you will need to get it from F-Droid. Once you successfully install Termux, update it.
pkg update
Upgrade it if it is outdated.
pkg upgrade
To install SSH server, run
pkg install openssh
Set a password to your current user by running
passwd
To find out your user ID, run
whoami
My phone is currently connected to the wifi, to find out the IP address run
ifconfig|grep inet
To start it, run
sshd
To customize the SSH server, the sshd_config is located at
/data/data/com.termux/files/usr/etc/ssh/sshd_config
Add these 2 configurations to the file
Port 8022
ListenAddress 0.0.0.0
Do not set port to 22 as it will not run. If you Android wifi has static address, you can set the ListenAddress to the static address.
Now that you know all the information required to connect it through SSH. To connect to it run
ssh -p 8022 u0_a306@192.168.1.251
To access phone internal storage, run the command below and give permission to termux in android settings.
termux-setup-storage