Skip to content

Configuring the script

Junicchi edited this page Aug 24, 2020 · 1 revision

Short Answer

After you updated script's first line with your phone's mac address, generate ssh keys using:

$ ssh-keygen -t rsa -f ./teriyaki_key -N " " -q

copy the public key (the one ending with .pub) to phone and keep the secret key on PC.

After that, on termux:

$ cat teriyaki_key.pub >> ~/.ssh/authorized_keys

edit script's 2nd line with the location of your key on PC.

$ mv ./teriyaki_key ~/.ssh/ PHONE_KEY="~/.ssh/teriyaki_key"

Detailed answer

First of all start by adding your phone's mac address to script's 2nd line. You can find your phone's mac address in phone settings>system>about phone>status>Wifi mac adress or from your wireless' admin panel, or using nmap like tools. The script needs your phone's MAC in order to find it's current IP address. MAC addresses are static unlike IP.

Now you need to exchange secret key in order to use teriyaki script without getting "enter ssh password" prompt every single time.

Generate an ssh secret key on your computer, the command below will generate a key with no password named teriyaki_key.

$ ssh-keygen -t rsa -f ./teriyaki_key -N " " -q

There will be 2 files generated after the command above. Copy the one ending with .pub to your phone. Keep the other on computer, you may move it to ~/.ssh folder also.

Now on termux, add the public key you generated on computer to ssh's authorized keys file using

$ cat teriyaki_key.pub >> ~/.ssh/authorized_keys

Now you can connect to termux ssh from pc using the secret key instead of entering password everytime, it's also more secure.

eg:$ ssh phoneip -p 8022 -i ~/.ssh/teriyaki_key

Now update the script (3rd line) with your secret key's location.

PHONE_KEY="~/.ssh/teriyaki_key"

Script is now ready to go. Don't forget to start ssh daemon (sshd) on termux before you use the script. You may want to acquire wake lock for faster response and to avoid timeouts.

Clone this wiki locally