Skip to content

Instantly share code, notes, and snippets.

@vibragiel
Last active February 8, 2019 13:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vibragiel/af5bc605c54ecd270dd837e4da1b1e0f to your computer and use it in GitHub Desktop.
Save vibragiel/af5bc605c54ecd270dd837e4da1b1e0f to your computer and use it in GitHub Desktop.
# Install F-Droid, Termux, Termux:API and Termux:Boot. Then open a Termux session and:
# pkg install curl && curl https://gist.github.com/gist_id | bash
PUBLIC_SSH_KEY_URL="https://gabi.is/id_rsa.chewie@gmail.com.pub"
pkg install openssh termux-api dnsutils
mkdir -p ~/.termux/boot/ ~/.ssh
[ -f ~/.termux/boot/daemons.sh ] || cat >~/.termux/boot/daemons.sh <<EOL
#!/data/data/com.termux/files/usr/bin/bash
termux-wake-lock
if ! pgrep "sshd" >/dev/null; then echo "[Starting sshd...]" && sshd && echo "[sshd started...]"; else echo "[sshd is running]"; fi
if ! pgrep "crond" >/dev/null; then echo "[Starting crond...]" && crond && echo "[crond started...]"; else echo "[crond is running]"; fi
EOL
curl $PUBLIC_SSH_KEY_URL >> ~/.ssh/authorized_keys
bash ~/.termux/boot/daemons.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment