SSH Into Linux Your Computer From Android With Termux


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 linux commands to be executed with root privileges either directly as a root user or by use of sudo command
  • $ – requires given linux commands 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 /home directory. Termux actually has a package manager, in the form of Apt, and it can install some basic packages.

Download Termux

You can get Termux from the Play Store, if you have it on your Android device.

Search For Termux in F-Droid

Fear not free software enthusiasts, Termux is available on F-Droid too. Open up F-Droid and search for Termux.

Install Termux through F-Droid

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 OpenSSH

sudo 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 Key

You 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).

Generate SSH keys on Android

It will take a few seconds or minutes to finish. It has to generate a fairly sizable key.

Send The Key To Linux

OpenSSH has a utility that makes transferring the key to your Linux computer super easy. Run the following linux command, only substitute your username and the IP of the computer.

$ ssh-copy-id -i ~/.ssh/ username@

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 It

All that’s left is to test it all out. Try using SSH through Termux to access your Linux computer.

$ ssh username@

You should log in automatically, without needing to enter your password. Now, whenever you need to get into your computer remotely from your phone, you can, and you don’t even need to enter the password. This also works with a VPN, so you can set up remote SSH access to your home PC from your phone.

NCMPCPP running over SSH in Termux

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.

This article being written in Vim over SSH in Termux

Closing Thoughts

There’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.

Comments and Discussions
Linux Forum