Skip to content

Instantly share code, notes, and snippets.

@txoof
Last active July 29, 2024 12:42
Show Gist options
  • Save txoof/f7670b80e983582f7af6d1a7791c15ab to your computer and use it in GitHub Desktop.
Save txoof/f7670b80e983582f7af6d1a7791c15ab to your computer and use it in GitHub Desktop.
Setup Termux on Android

Termux & Macrodroid Setup on Android

Setup termux for ssh, scripts, tasker/macrodroid integration

Install:

Note If secure Google accounts are active on the device, it is not possible to install apps from Fdroid Store

Install The following from the Fdroid Store:

  • Termux
  • Termux:API
  • Termux:Widget
  • Termux:Tasker

Alternatively install from Termux Git Repos

Install Macrodroid from the play store

  • Open Macrodroid and grant all permissions
  • Grant Macrodroid permission to run termux scripts: Apps > Macrodroid > Permisisons > Additional Permissions > Run commands in Termux

Install Software in Termux

  • pkg update; pkg upgrade
  • pkg install vim netcat-openbsd rsync zsh git python3 termux-api

Install Open SSH server

  • $ pkg install openssh
  • generate a password: password
  • Generate & distribute keys
  • $ ssh-keygen
  • distribute ~/.ssh/id_rsa.pub as needed (add to github)
  • Add authorized keys to termux
    • $ nano ~/.ssh/authorized_keys
    • add keys from remote hosts as needed
  • generate key for rrsync
    • $ ssh-keygen -f ~/.ssh/rrsync_media-server_id_rsa
  • disable password authentication:
    • vim $PREFIX/etc/ssh/sshd_config -- PasswordAuthentication no

Setup Environment

  • Grant termux permission to "Appear on top" of other apps:
    • Settings > Apps > Termux > Appear on top > On
  • Setup storage -- this is best done from the device to trigger the permissions dialog
    • termux-setup-storage
  • Install oh-my-zsh
  • sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
  • clone and setup Dotfiles:
    • pip3 install dotfiles
    • git clone dotfiles_repo
    • ln ~/Dotfiles/dotfilesrc .dotfilesrc
    • dotfiles -s --force
  • clone shell scripts
    • git clone scripts repo
  • Move scripts into ~/.shortcuts and setup symbolic links
    • mv androidScripts ~/.shortcuts; chmod 0700 ./.shortcuts
    • ln -s ~/.shortcuts/ bin; ln -s ~/.shorctus/ ~/ scripts
  • Create symlink for tasker: * cd ~/.termux/; rm ./tasker; ln -s ~/.shortcuts ./tasker

Update Tasker Macros

Sometimes the termux jobs cannot locate the tasker plugin paths and the actions need to updated.

  • Open macro
  • Under actions locate the "Termux Shortcut"
  • Touch "+" > Applications > Tasker > Termux:Tasker > Event
  • Enter the script name and touch save
    • If no scripts appear the sympling between ~/.shortcuts and ~/.termux/tasker us borked. Fix it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment