WRITELOOP

TERMUX (ANDROID) TIPS

2018 March 11

I use termux to have a functional linux system on my Android phones without requiring the device to be rooted. For some days I have being thinking about using it to auto-backup some files on my device to my DigitalOcean spaces account, so to keep some important backups there. So, am also playing with Automate (which you can download from the Play Store) that will allow me to automate some actions and many other things on my phone. Below are some tips on termux that ease this flow of mine.

How to enable termux to access the SDCARD on Android:

$ termux-setup-storage

The access will be at “/sdcard” (e.g.: /sdcard/Downloads).

How to install s3cmd:

$ apt install python
$ pip install s3cmd

Using the SSH server

The sshd server is included in the openssh package and allows you to connect to your Android device over ssh. Start the server by executing sshd (which will start it on the default port 8022) and run logcat -s 'syslog:*' to view the log output from the server process. Execute pkill sshd to stop the server.

Since Termux is a single-user system you may connect as any user - regardless of your specified username you will login as the only Termux user available.

The Termux sshd binary does not support password logins, so a key needs to be authorized in ~/.ssh/authorized_keys before connecting. Use ssh-keygen to generate a new one if desired.

Installing extras from the play store:

  • Termux:API Access Android and Chrome hardware features.

  • Termux:Boot (paid) Run script(s) when your device boots.

  • Termux:Task (paid) An easy way to call Termux executables from Tasker and compatible apps.

  • Termux:Widget (paid) A widget that you can use to trigger some scripts manually without opening the termux app.

How to Install a tmux flow on Automate

Through the “Community” icon, search for “termux”.

How to add a script to the termux widget list of scripts

Add a symbolic link on ~/.shortcuts to the desired scripts. E.g.:

ln -s /data/data/com.termux/files/home/src/bitbucket/termux-android/upgrade_motd.sh ~/.shortcuts/upgrade_motd.sh