How to install SSH in Termux on Android (OpenSSH) 2022

install openssh in termux

Are you looking for a step by step guide to install ssh (openSSH) in Termux on Android without root? If so, then you are in the right place.

Introduction

OpenSSH is considered one of the best methods for logging in to a remote server and running linux commands. The encryption of all data packets going from your local network to the target server means that a third party cannot intercept your connection. It also ensures that no one can eavesdrop on your communications since encryption protocol also eliminates eavesdropping. OpenSSH and dropbear are the two most popular SSH tools, and OpenSSH is the most recommended.

OpenSSH features includes – Strong cryptography support (AES, ChaCha20, RSA, ECDSA, Ed25519), X11 forwarding, Port forwarding, Strong authentication(public keys, one-time passwords), Agent forwarding, Interoperability, SFTP client and server support, and Optional data compression.

In this tutorial, I’m going to show you how to install openSSH in termux on Android without root.

How to install OpenSSH in Termux

To install Openssh in termux you need to first install termux terminal on your android device and then download and execute openssh binary in termux.

Let’s see how.

Step 1: Install Termux emulator

I’m assuming you’ve already installed termux on your android device. If you have not installed it yet, then follow this step by step guide.

In order for this to work, you have to ensure that termux is allowed access to your local storage files, otherwise the emulator will throw an error message that it is unable to locate the Openssh package.

Step 2: Update and Upgrade packages

Ensure that all packages and binaries have been updated to the newest build now. You can upgrade the package files with the following command.

apt update && apt upgrade

Step 3: Install OpenSSH package

You can now download and install the openssh build from the repository server. To download and install the packages run the below command.

pkg install openssh

That’s it. You have now successfully installed ssh in termux without rooting your device. Read further to learn useful ssh commands.

 

OpenSSH commands list For Termux (Android)

No. Description Commands Notes
1 Start the SSH server sshd You can now access your ssh service on port 8022.
2 Kill the SSH server pkill sshd This command will stop the server.
3 Specify a Username for connection ssh [email protected]_or_hostname By default, ssh uses the current user for accessing remote servers. However, you can specify the user manually with this command.
4 Change port number ssh test.exampleserver.com -p 2500 By default, you can access the ssh service on port 8022. If you want to assign different ports, then use this command.
5 Generate a ssh key ssh-keygen -t rsa You can secure your connection by generating a ssh key with this command.
6 Copy Public SSH Key ssh-copy-id IP_or_hostname You can copy the public ssh key with this command.
7 Restart the ssh service sudo sshd service restart This command is very useful if you want to restart or reboot the ssh server.
8 Verify connection ip addr To verify, whether the ssh is connected to the server or not. You can use this command.

 

Conclusion

The best tool for logging into a remote server is OpenSSH. With its built-in encryption, your work is private and no third parties can intercept your connection. Developers or data scientists often have to upload and download data from their work computers to remote servers. It would be impossible for anyone to use a computer instantly. At that point, termux makes things easier for you in your Android device by delivering advanced functionality.

Thank you for reading this article. The above step-by-step guide should have helped you install SSH in the termux emulator on Android without rooting. In case you have any questions regarding the above guide, you can leave a comment below. You can find some interesting articles about termux here.