Skip to content

Instantly share code, notes, and snippets.

@hdformat
Last active January 22, 2021 06:21
Show Gist options
  • Save hdformat/6c4db01aa1f996874e2bb2ecaa48d895 to your computer and use it in GitHub Desktop.
Save hdformat/6c4db01aa1f996874e2bb2ecaa48d895 to your computer and use it in GitHub Desktop.
Termux SSH

install openssh

$ pkg install openssh

run sshd (default port is 8033 not 22)

$ sshd

get the current user's id

$ whoami
u0_a253

set the current user's passwod

$ passwd u0_a253
New password:
Retype new password:
New password was successfully set.

get the current IP address

$ ifconfig
lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  txqueuelen 1000  (UNSPEC)
        RX packets 25  bytes 2808 (2.7 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 25  bytes 2808 (2.7 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

p2p0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  txqueuelen 1000  (UNSPEC)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.0.38  netmask 255.255.255.0  broadcast 192.168.0.255
        inet6 fe80::3c27:f8ff:fea6:9d87  prefixlen 64  scopeid 0x20<link>
        unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  txqueuelen 1000  (UNSPEC)
        RX packets 520024  bytes 650252591 (620.1 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 115192  bytes 29507032 (28.1 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

connect to Termux from Windows

PS > ssh u0253@192.168.38 -p 8022
The authenticity of host '[192.168.0.38]:8022 ([192.168.0.38]:8022)' can't be established.
ECDSA key fingerprint is SHA256:ydZHAgojLyLGCBg4kEKM+b1ra1E44Pe5TPTRUB8M6pg.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '[192.168.0.38]:8022' (ECDSA) to the list of known hosts.
u0253@192.168.0.38's password:

Welcome to Termux!

Wiki:            https://wiki.termux.com
Community forum: https://termux.com/community
Gitter chat:     https://gitter.im/termux/termux
IRC channel:     #termux on freenode

Working with packages:

 * Search packages:   pkg search <query>
 * Install a package: pkg install <package>
 * Upgrade packages:  pkg upgrade

Subscribing to additional repositories:

 * Root:     pkg install root-repo
 * Unstable: pkg install unstable-repo
 * X11:      pkg install x11-repo

Report issues at https://termux.com/issues

$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment