DEV Community

Ipii
Ipii

Posted on

How to install SSH Server in Termux

Hi!! Now i will make tutorial how to install ssh in Termux. SSH (Secure Shell Protocol) is a cryptographic network protocol for operating network services securely over an unsecured network. Its most notable applications are remote login and command-line execution.

Now i will give you the tutorial at here :

1. Update your packages in Termux
First, you need to update your packages to up to date. here is the command :

pkg update && pkg upgrade -y
Enter fullscreen mode Exit fullscreen mode

2. Install SSH package in Termux
After that, you need to install ssh package in termux here is the command :

pkg install openssh -y
Enter fullscreen mode Exit fullscreen mode

3. Edit configuration ssh file
Now you need to configure the file with nano if you don't have nano you can install it pkg install nano -y. now you can open the configuration ssh file :

nano $PREFIX/etc/ssh/sshd_config
Enter fullscreen mode Exit fullscreen mode

now you just unblock Port 22 and edit it with 4 digits like this :

Port 2222
Enter fullscreen mode Exit fullscreen mode

Note : You need to set it to 4 digits or it won't work.

you can exit and save it with ctrl + x, y, enter.

4. Activate SSH Server
to activate you just type it in termux :

sshd
Enter fullscreen mode Exit fullscreen mode

Now it's done you can just test it at another device with :

ssh -p <port-ssh-server> <username-ssh-server>@<ip-ssh-server>
Enter fullscreen mode Exit fullscreen mode

e.g

ssh -p 2222 u0_123@192.168.0.1
Enter fullscreen mode Exit fullscreen mode

for search username you can type whoami
and ip you just type ifconfig

Yipppieee! now you can make ssh server in termux. thanks all for supporting me i will make tutorial about termux haha.

Source :

https://en.wikipedia.org/wiki/Secure_Shell
https://wiki.termux.com/wiki/Remote_Access

Top comments (0)