Most of the time it would be easy to assume you’re connecting from another computer. You might not have access to a computer all of the time, though. But what about your Android device? Not only is connecting from an Android device doable, it’s fairly easy.
Before you get started
Before you start connecting to your server from Android, you should consider how it affects security. Connecting from Android isn’t inherently insecure, but any additional way you connect to your server is another door. Adding a door means that someone else could potentially open that door. That’s not even considering unintended vulnerabilities like Heartbleed, which caused major trouble a few years ago. Whether or not you’re connecting from Android, you should read up on hardening your server. After all, better safe than sorry.
Set up your server
One of the most common and secure ways to connect to your server is SSH, or Secure Shell. If you haven’t already done so, you’ll want to install OpenSSH, which also includes SFTP (Secure FTP). Installing and configuring SSH is easy, but beyond the scope of this article. Fear not, as we have a step-by-step guide to installing and configuring SSH and SFTP on Ubuntu. Even if you’re using another distribution, those instructions can get you most of the way there.
Set up your Android device
Both SSH and SFTP are pretty keyboard-heavy, so you may want to consider using a Bluetooth keyboard with your device. There are plenty of Android-compatible Bluetooth keyboards available, and many of them are very affordable. Alternatively, if you don’t have access to an external keyboard, you can install and use the Hacker’s keyboard app. Next, you’ll need to get yourself an SSH app to connect to your server from Android. Two of the most popular options available right now are JuiceSSH and Termius.
JuiceSSH
JuiceSSH supports Bluetooth keyboards and offers plenty of options. The base version of the app supports two-factor authentication, optional plugins, and ZLib compression on SSH connections. Upgrading to the Pro version adds more color schemes, automatic backup of your connections, and a handy widget. The app is available for free on the Google Play Store.
Termius
Termius is another popular option. In addition to SSH, this app also supports SFTP. If you frequently find yourself needing to upload files from your Android device to your server, this is handy. The free version of the app available on Google Play has most of the features you’ll need. Unfortunately, SFTP support is only included in the Premium version, which costs $59.88 per year.
Connecting to your server
To connect to your server, you’ll either need your username and password or your private SSH key. Using a username and password is easier but is also far less secure. The guide to configuring SSH on Ubuntu above includes a step on generating your keys. To use these with your Android SSH app of choice, you’ll need to copy your public key to your device. One of the easiest ways to do this is to save your key in a password manager like 1Password or LastPass and copy and paste it on your Android phone.
Determining your IP address
Once you have your key imported, all you’ll need is your server’s IP address. There are multiple ways to determine this. First you need to know which IP address you’re looking for. If your server is a web host or a remote host from a service like Linode or DigitalOcean, you’ll need your server’s public IP address. One simple way is to type the command curl ifconfig.me in a terminal window on your server. This uses a website to retrieve your public IP address. If you’re connecting to a server in your home, you’ll want your private IP address. A simple way to determine this is to type the command ifconfig | grep inet. You’ll see a few lines of text. One of these will contain your IP address which is typically in the format 192.168... Once you have your private key and IP address, you can use this to connect from your Android device. If you’re looking for things to do on your server’s command line, we have a list to get you started.