Termux#

SSH#

https://wiki.termux.com/wiki/Remote_Access

server#

# install
pkg install openssh
# check that $PREFIX exists
echo $PREFIX
# configure
cat <<'EOF' > $PREFIX/etc/ssh/sshd_config
PrintMotd no
PasswordAuthentication no
Subsystem sftp /data/data/com.termux/files/usr/libexec/sftp-server
EOF
# run
sshd

wifi wants to sleep. create script on mobile:

cat <<'EOF' > burn-battery
while true; do
  sleep 0.1
  date
done
EOF
chmod +x burn-battery

client#

id -u
cat <<'EOF' >> ~/.ssh/config
# ssh s7 -t -- ./burn-battery >/dev/null
# to keep wifi from going to sleep
Host sx
  Hostname sx
  User u0_a560
  Port 8022
EOF

ssh s7

mount via sshfs#

mkdir -p /tmp/sx-home /tmp/sx-root
sshfs sx: /tmp/sx-home
sshfs sx:/storage/emulated/0 /tmp/sx-root

umount

umount /tmp/sx-home /tmp/sx-root

Termux API#

Rabbit hole! :D

termux-notification \
	--content "HELLO from termux" \
	--group stuff \
	--title 'hello world!' \
	--action "termux-toast i am the on-click action handler"
termux-tts-speak -l en -n gb "hello world"

There is no termux-call-log any more. :( termux/termux-api#257

Termux Shortcuts#

termux/termux-widget

git init ~/.shortcuts

sshd#

cat <<'EOF' > ~/.shortcuts/sshd
#!/data/data/com.termux/files/usr/bin/bash
sshd -d &
sshd_pid=$!
read
kill $sshd_pid
true
EOF

chmod +x ~/.shortcuts/sshd