If you've ever wanted to write code on your Android phone, or work on files on your laptop while you're standing around somewhere you can't pull out your laptop, this is the way to do it!
On your Android phone, please install F-Droid. You'll need to download the APK and open it. If it asks you whether you want to install an "unknown app", allow it. Then, in F-Droid, search for "Termux" and install the "Termux" app.
Alternatively, you can download the Termux APK by itself, but it won't auto-update.
Now, you're ready to follow with this guide. Please follow this guide on a secure network, as it will temporarily leave your devices open to network attacks. Once you've finished the setup process, it will be safe to use on insecure networks.
Please do not ever share the files id_rsa
, id_rsa.pub
, or the directory ~/.ssh
with anyone. This will create a security risk.
- In Termux:
pkg up
pkg install openssh
passwd # set a password
ssh-keygen -A
sshd
ifconfig
# Use the output of ifconfig to find the IP address
- In GNU/Linux:
# Change this to the IP address of the Android phone
androidip=143.195.81.101
ssh-keygen -t rsa -b 2048 -f id_rsa
ssh-copy-id -p 8022 -i id_rsa $androidip
cp id_rsa ~/.ssh/id_rsa
cp id_rsa.pub ~/.ssh/id_rsa.pub
If you add a passphrase, then you need to use it every time you ssh
. Otherwise, you'll be able to log in without a passphrase.
- In Termux:
sed -i "s/PasswordAuthentication yes/PasswordAuthentication no/" $PREFIX/etc/ssh/sshd_config
pkill sshd; sshd
- In GNU/Linux:
sudo apt install openssh-server
sudo systemctl enable ssh
hostname -i
# Use the output of ifconfig to find the IP address
- In Termux:
# Change this to the IP address of the GNU/Linux desktop
desktopip=143.195.87.67
ssh-keygen -t rsa -b 2048 -f id_rsa
ssh-copy-id -p 22 -i id_rsa ethan@$desktopip
cp id_rsa ~/.ssh/id_rsa
cp id_rsa.pub ~/.ssh/id_rsa.pub
If you add a passphrase, then you need to use it every time you ssh
. Otherwise, you'll be able to log in without a passphrase.
- In GNU/Linux:
sudo sed -i "s/PasswordAuthentication yes/PasswordAuthentication no/" /etc/ssh/sshd_config
sudo systemctl restart ssh