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.
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:
- Open the Google Play Store on your Android device
- Search for SimpleSSH
- Locate and tap the entry by galexand
- Tap Install
- 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)
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:
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:
Where IP is the IP address presented on the SimpleSSH window (Figure A).
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.
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)
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.
- Android Oreo: The smart person's guide (TechRepublic)
- Need an SSH client for Android or Chromebook? Check out Termius (TechRepublic)
- How to set up an easy local backup for Android device folders (TechRepublic)
- 3 tips to make using ssh easier (TechRepublic Video)
- This new app can detect wireless credit card skimmers at gas pumps (ZDNet)
Jack Wallen is an award-winning writer for TechRepublic and Linux.com. He’s an avid promoter of open source and the voice of The Android Expert. For more news about Jack Wallen, visit his website jackwallen.com.