Skip to content

Instantly share code, notes, and snippets.

@ScottJWalter
Forked from txoof/Setup.md
Last active January 22, 2024 11:15
Show Gist options
  • Save ScottJWalter/a852d1bcbb2beabc967f4148997bec34 to your computer and use it in GitHub Desktop.
Save ScottJWalter/a852d1bcbb2beabc967f4148997bec34 to your computer and use it in GitHub Desktop.
Setup Termux on Android #termux #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
  • 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