Mobility Google

How to install an SSH server on your Android phone

If you have a need to secure shell into your Android device, there are plenty of tools available. One of the easiest is SimpleSSH. Here's how to install and use this handy app.

3 tips to make using ssh easier

Upon reading the title, the first question out of your mind might be, "Why?" the answer will depend upon your usage. You might want a secure way to copy files from your device. If you're a developer, you might want to have easy access to the filesystem hierarchy. Whatever your reason, there are apps available in the Google Play Store that will serve this purpose well. One of my favorites is called SimpleSSHD. This Android SSH server doesn't offer much in the way of bells and whistles, but it does the trick and does so easily.

Let's install SimpleSSH and see how to make use of it.

Installation

I will be installing SimpleSSH on a OnePlus 3, running Android 7.1.1. SimpleSSH will run on Android 2.1 and up, so you can be certain (unless your device is really old), this app will work. SimpleSSH also does not require a rooted device.

The installation is simple. Follow these steps:

  1. Open the Google Play Store on your Android device
  2. Search for SimpleSSH
  3. Locate and tap the entry by galexand
  4. Tap Install
  5. Allow the installation to complete

And that's it for installation. You will find the SimpleSSH launcher in your App Drawer or on your home screen (or both). Tap the app icon to start SimpleSSH.

SEE: Mobile device computing policy (Tech Pro Research)

Usage

Using SimpleSSH might not be the single most obvious task in the toolbox. Why? If you're accustomed to using SSH, you know to log into an SSH server is only a matter of issuing a command like:

ssh USERNAME@IP


Where USERNAME is the name of a user and IP is the IP address of the remote server. One thing should immediately pop out to you--what username? Sure SimpleSSH makes it clear what IP address to use, but what about the username? Simple -- you don't work with a username. Instead, the command to secure shell into your Android device will be of the form:

ssh IP


Where IP is the IP address presented on the SimpleSSH window (Figure A).

Figure A

The SimpleSSH main window.


There are two other things to know about logging into the SimpleSSH server. First off, it does not use the standard SSH port of 22 (because that is a privileged port the app cannot access). Out of the box, SimpleSSH is set to port 2222. You can change this (from within Settings), but let's assume you'll stick with the default port of 2222. So to log into SimpleSSH, the command would now be:

ssh IP -p 2222


Tap the START button on the SimpleSSH window and then, back at your desktop client, issue the above command. You will see a one-time password appear on the SimpleSSH screen (Figure B). Enter that password from the terminal you are using to log into the SimpleSSH server and you will be given access.

Figure B

Your one-time password to log into SimpleSSH.


That password will only work with one login attempt. If you type it incorrectly, you will be given a new one-time password. Once you've successfully logged in, you will be deposited into the /storage/emulated/0/ssh directory. Do note, this directory is not readable, so you will have to change to a directory that does have read access. Issue the command cd ../ and you will move up one directory (to /storage/emulated/0) that does offer read and write access.

SEE: Special report: Cybersecurity in an IoT and mobile world (free PDF) (TechRepublic)

SCP

SimpleSSH also enables the use of secure copy. Say you want to securely copy a file from your desktop to your Android device. This can be done using the scp command. The one thing you must remember, is that scp handles alternative ports a bit differently than does ssh. So the command to copy a file from a desktop to your Android device would look like:

scp -P 2222 /PATH/TO/LOCAL/FILE IP:/PATH/TO/REMOTE/FILE


Where IP is the IP address of your Android device, /PATH/TO/LOCAL/FILE is the path that houses the file on the local device (ending with the filename), and /PATH/TO/REMOTE/FILE/ is the path that will house the remote file (ending with the filename). When you issue that command, SimpleSSH will give you a new one-time password to use. Once authenticated the file will copy and you're good to go.

After you are finished using SimpleSSH, make sure to stop the server, by tapping the STOP button.

SSH server made simple

There are a few SSH servers available for Android, but SimpleSSH makes connecting via ssh (or scp) a bit simpler than the other tools. Give this app a try and see if it doesn't help make your ssh to Android connections needs a bit easier.

Also see

Image: Jack Wallen
Visit TechRepublic