A New Collection of Thoughtful Learning Apps — Now Available on iOS & Android

Image
I’m excited to share a set of mobile apps I’ve recently completed and published on both the Google Play Store and the Apple App Store. These apps are designed with a simple goal in mind: to make meaningful, structured content more accessible, whether you’re studying theology or improving your English vocabulary. 📱 Now Available on Both Platforms All apps are live and available for download: Google Play Developer Page: https://play.google.com/store/apps/dev?id=5835943159853189043 Apple App Store Developer Page: https://apps.apple.com/ca/developer/q-z-l-corp/id1888794100 📖 Theology & Confession Study Apps For those interested in Reformed theology and classical Christian teachings, I’ve developed a series of apps that present foundational texts in a clean, focused reading format: The Belgic Confession Canons of Dort Heidelberg Catechism Westminster Shorter Catechism Each app is designed to provide a distraction-free experience, making it easier to read, reflect, and revisit these im...

How to SSH into an Oracle Cloud VPS from Android Using Termux and Cloudflare Tunnel

 

How to SSH into an Oracle Cloud VPS from Android Using Termux and Cloudflare Tunnel

You don't need a public IP address to SSH into your Oracle Cloud VPS from your Android phone.

With Termux, OpenSSH, Cloudflare Tunnel, and Cloudflare Access, you can securely connect to your Oracle Cloud VPS directly from your Android device.



In this tutorial, I'll show you how to configure everything step by step.

1. Architecture

Here is how the connection works:

Android Phone
     |
     v
Termux + OpenSSH
     |
     v
cloudflared (ProxyCommand)
     |
     v
Cloudflare Access
     |
     v
Cloudflare Tunnel
     |
     v
Oracle Cloud VPS
     |
     v
localhost:22 (SSH)

The VPS does not need a public IP address or an exposed SSH port.

Cloudflare Access handles authentication, while SSH public-key authentication verifies the user on the VPS.

2. Prerequisites

Before starting, make sure you have:

  • An Oracle Cloud VPS running Linux.

  • A Cloudflare Tunnel already connected to your VPS.

  • A Cloudflare Public Hostname configured for SSH.

  • A Cloudflare Access application protecting that hostname.

  • SSH access to your VPS from another computer (for example, your Mac).

For this tutorial, I'll use the following example configuration:

SettingValue
VPS providerOracle Cloud
VPS usernameopc
SSH port22
SSH hostnamessh.qzlapp.us.ci
Android terminalTermux

Replace the hostname with your own domain.

3. Install Termux

Install Termux on your Android phone.

I recommend downloading it from F-Droid or the official Termux GitHub releases.

Open Termux and update the packages:

pkg update && pkg upgrade -y

Install OpenSSH and cloudflared:

pkg install openssh cloudflared -y

Verify the installation:

ssh -V
cloudflared --version

4. Generate an SSH Key on Android

Instead of copying your Mac's private SSH key to your phone, generate a separate key pair.

mkdir -p ~/.ssh
chmod 700 ~/.ssh

ssh-keygen -t ed25519 \
  -f ~/.ssh/oci_android \
  -C "android-termux"

The -C option adds a comment to identify the key. It is not the VPS username.

For example:

  • android-termux is the key comment.

  • opc is the Linux username on Oracle Cloud.

You now have two files:

~/.ssh/oci_android
~/.ssh/oci_android.pub

The first file is your private key. Never share it.

The second file is your public key.

Display the public key:

cat ~/.ssh/oci_android.pub

Copy the entire output.

5. Add the Android Public Key to Oracle Cloud VPS

From your Mac or another computer that already has SSH access to the VPS, connect to your server:

ssh oci

Open the authorized keys file:

mkdir -p ~/.ssh
chmod 700 ~/.ssh

nano ~/.ssh/authorized_keys

Paste the Android public key on a new line.

Save the file and update its permissions:

chmod 600 ~/.ssh/authorized_keys

Your VPS now recognizes the SSH key generated by your Android phone.

You can keep your Mac's existing SSH key. Both devices can have separate keys.

6. Configure SSH on Android

Back in Termux, create or edit your SSH configuration:

nano ~/.ssh/config

Add the following configuration:

Host oci
    HostName ssh.qzlapp.us.ci
    User opc
    ProxyCommand cloudflared access ssh --hostname %h
    IdentityFile ~/.ssh/oci_android
    IdentitiesOnly yes

Save the file and set the permissions:

chmod 600 ~/.ssh/config
chmod 600 ~/.ssh/oci_android

Let's understand the important settings.

Host oci

This is a shortcut. Instead of typing the full hostname, you can simply run:

ssh oci

User opc

This is the Linux username on Oracle Cloud.

ProxyCommand

ProxyCommand cloudflared access ssh --hostname %h

This is the most important part.

OpenSSH normally connects directly to the SSH server. However, our VPS does not expose SSH directly to the public internet.

The ProxyCommand tells SSH to start cloudflared and use it as a proxy.

The %h variable represents the hostname defined in HostName.

Cloudflared establishes the connection through Cloudflare Access and the Cloudflare Tunnel.

Notice that we don't need to specify a full executable path on Android. Termux can find cloudflared through its PATH.

7. Authenticate with Cloudflare Access

Before connecting, authenticate through Cloudflare Access:

cloudflared access login https://ssh.qzlapp.us.ci

Follow the authentication instructions.

If Termux does not automatically open your browser, copy the authentication URL and open it in Chrome.

Sign in using an email address permitted by your Cloudflare Access policy.

Make sure the Cloudflare Access application protects the SSH hostname.

8. Connect to Your Oracle VPS

Now the fun part!

Simply execute:

ssh oci

You should be connected to your Oracle Linux VPS.

For example:

[opc@oci-vps ~]$

That's it!

You can now manage your Oracle Cloud VPS directly from your Android phone without a public IP address.

9. Troubleshooting

Connection closed by UNKNOWN port 65535

If you see:

Connection closed by UNKNOWN port 65535

Check the following:

  1. Is cloudflared installed correctly?

  2. Is the Cloudflare Access application configured for your SSH hostname?

  3. Have you completed Cloudflare Access authentication?

  4. Is the Cloudflare Tunnel running?

  5. Does the VPS SSH service work locally?

You can enable SSH debugging:

ssh -vvv oci

Also check:

which cloudflared
cloudflared --version

Permission denied (publickey)

Check that:

  • You copied the correct public key to the VPS.

  • The VPS username is correct (opc in this example).

  • The private key path in ~/.ssh/config is correct.

  • File permissions are correct.

Conclusion

Combining Termux, OpenSSH, and Cloudflare Tunnel gives you a convenient way to manage an Oracle Cloud VPS from your Android phone.

My favorite part is that the VPS does not need a public IP address.

The same approach also works on macOS and Linux. Once configured, connecting is as simple as:

ssh oci

No need to remember complicated commands or expose SSH directly to the internet.

Happy hacking!

❤️ Support This Blog


If this post helped you, you can support my writing with a small donation. Thank you for reading.


Comments

Popular Posts

A New Collection of Thoughtful Learning Apps — Now Available on iOS & Android

react-native run-android : do not build/update modified code(App.js)