I would like to automatically connect to an SSH remote with port forwarding on my Android TV.
ssh myuser@example.com -L 445:localhost:445
I can run this successfully with Termux, however I have to run it manually.
Is it possible to automatically run this command so that every time the Android TV turns on, it connects to my SSH remote with said port forwarding?
Yes, it's possible to automatically run the ssh command with port forwarding on Android TV when it turns on.
Open Termux and create a shell script file with the following contents:
#!/data/data/com.termux/files/usr/bin/bash
# replace "myuser@example.com" with your ssh username and remote hostname
ssh myuser@example.com -L 445:localhost:445
Save the file with a .sh extension (e.g. startssh.sh) and make it executable with the following command:
echmod +x startssh.sh
Open the Termux Startup app from the app drawer and add the script to the list of startup commands.