Termux Matrix ((link)) Page

Set up a Matrix bot in Termux using mautrix-python to respond to commands or forward messages to Telegram.

#!/data/data/com.termux/files/usr/bin/bash tmux new-session -d -s matrix '~/go/bin/gomuks' pkg install tmux tmux new -s matrix # Inside: launch gomuks # Detach: Ctrl+B, D # Reattach: tmux attach -t matrix Share files via Matrix # Upload a file (send to current room in gomuks) curl -F "file=@/sdcard/Download/photo.jpg" https://matrix.org/_matrix/media/v3/upload # Then share the MXC URL SSH into Termux + Matrix Run Termux’s SSH server, connect from laptop, and use Matrix CLI from anywhere: termux matrix

pkg update && pkg upgrade pkg install golang git make Two excellent command-line Matrix clients work well in Termux: Option A: gomuks (easier, good for touch) go install github.com/tulir/gomuks@latest Option B: weechat + weechat-matrix (more features) pkg install weechat Step 3 – Configure & Run For gomuks: ~/go/bin/gomuks First run creates config in ~/.gomuks/ . Log in with: /login <homeserver> <username> <password> Example: /login https://matrix.org @alice:matrix.org Set up a Matrix bot in Termux using

| Command | Action | |---------|--------| | /join #room:server | Join a room | | /leave | Leave current room | | /invite @user:server | Invite user | | /toggle encryption | Enable/disable E2EE | | Ctrl+L | Redraw screen (useful after suspend) | For weechat: weechat /plugin install matrix /set matrix.server.matrix.homeserver "https://matrix.org" /connect matrix Then use /matrix login to authenticate. Step 4 – Practical Termux-Specific Tips Keep running in background Install Termux:Boot to auto-start a session: Step 4 – Practical Termux-Specific Tips Keep running

→ Your session is untrusted. Run /verify own and verify with another device.

pkg install openssh sshd # On laptop: ssh -p 8022 user@phone_ip # Then run gomuks | Risk | Mitigation | |------|-------------| | Screen logging | Termux logs aren’t persistent by default, but disable history: set +o history | | Key storage | E2EE keys stored in ~/.gomuks/ – backup with tar -czf matrix-keys.tar.gz ~/.gomuks/ | | Clipboard exposure | Termux can read Android clipboard – avoid pasting recovery keys | | Background process | Use termux-wake-lock to prevent Android killing the client |

→ Use weechat with minimal UI: /matrix set format text Advanced: Run Your Own Matrix Bridge in Termux Want to bridge Discord to Matrix? Install a puppeted bridge: