Install Termux on an Android device and use it to establish passwordless SSH to a Linux computer.
This guide will work with any Linux computer.
A working Linux computer and an Android device.
- # - requires given command to be executed with root privileges either directly as a root user or by use of
- $ - given command to be executed as a regular non-privileged user
It might seem kind of strange, but being able to access the command line of your computer remotely from your phone is very convenient, especially when paired with an excellent Android terminal emulator, like Termux. Termux makes the process very easy. It emulates parts of a GNU/Linux, including a
directory. Termux actually has a package manager, in the form of Apt, and it can install some basic packages.
You can get Termux from the Play Store
, if you have it on your Android device.
Fear not free software enthusiasts, Termux is available on F-Droid too. Open up F-Droid and search for Termux.
It should show up right away. Select the one that's just "Termux." When you're on the app page, download it.
Generate Your Key
Open up the app. You shouldn't have to do anything before you get started. It works just like a normal Linux terminal emulator.
Install OpenSSHsudo or root privileges required. Termux is sandboxed.
$ apt install openssh Again, Apt will behave exactly how you'd expect it to on a Debian distribution.
Create The KeyYou can create the key exactly how you would on Linux. For ore depth, check out our SSH passwordless login guide. So, start by creating your key.
$ ssh-keygen -b 4096 -t rsa For the easiest solution, just press "Enter" for each of the questions that you're asked. It will just use the defaults and not require a password(that's a good thing).
It will take a few seconds or minutes to finish. It has to generate a fairly sizable key.
Send The Key To LinuxOpenSSH has a utility that makes transferring the key to your Linux computer super easy. Run the following command, only substitute your username and the IP of the computer.
.1.1 You will be prompted to enter the password for the user on the Linux computer. Do so. It's the only time you'll have to.
Test ItAll that's left is to test it all out. Try using SSH through Termux to access your Linux computer.
Termux works with just about any CLI application you can think of. The picture above is a somewhat impractical example, but it just demonstrates that it will work with just about anything you're thinking of, including a fully customized and configured Vim.
Closing ThoughtsThere's obviously a lot you can do with Termux, and using it to SSH into your Linux computer from your phone afford a lot of those options.
Termux only has the Android touch keyboard available to it, so that is somewhat limiting. The developers accounted for that, though, by providing hotkeys that utilize other buttons on your device. You can check out the hotkeys here. Have fun, and happy hacking.