Remote Access - Termux Wiki (2023)

Termux can access remote devices using some common tools. It is also possible to turn a device running Termux into a remote controlled server.

contents

  • 1 FTP
  • 2 SSH
    • 2.1 Using the SSH client
      • 2.1.1 Application example
        • 2.1.1.1 SSH Agent
    • 2.2 Using the SSH server
      • 2.2.1 OpenSSH
        • 2.2.1.1 Starting and stopping the OpenSSH server
        • 2.2.1.2 Set password authentication
        • 2.2.1.3 Configuring public key authentication
      • 2.2.2 Autumn berries
        • 2.2.2.1 Start and stop the Dropbear server
        • 2.2.2.2 Set password authentication
        • 2.2.2.3 Configuring public key authentication
    • 2.3 Using SFTP
  • 3 FLIES
    • 3.1 Application example
  • 4 synchronization
    • 4.1 Application example
  • 5 See also

Caveat: Simple FTP is outdated and insecure anyway. Termux FTP server only supports anonymous login, there is no authentication and anyone on your network can access the files on your device. Use SFTP (OpenSSH) instead!

The Termux FTP server is based on Busybox and the service is managed by [Termux-services]. If you decided to use an FTP server, install these packages:

pkg install busybox termux services

After installation, you need to reboot the session or get this file:

Califica $PREFIX/etc/profile.d/start-services.sh

Now you can enable and start the FTP daemon service:

sv-habilitar ftpdsv hasta ftpd

The FTP server runs on port 8021 in read-only mode.

If you need to stop the server, run it.sv down ftpd.

SSH provides a secure way to access remote hosts, replacing tools like telnet, rlogin, rsh, ftp. Termux provides SSH through two packages:bear dropmiopen switch🇧🇷 If you have never used these tools before, it is recommended to install 'openssh' as ​​it is more common.

Using the SSH client

You can get an SSH client by installing `openssh` or `dropbear`.

application example

To log in to a remote computer running the ssh daemon on the default port (22):

ssh user@hostname_or_ip


Same as above, but if the ssh daemon is running on a different port, say 8022:

(Video) How to control remotely Android using Metasploit in termux | Apk Payload creating | without Root.

ssh -p 8022 user@hostname_or_ip


Using public key authentication with ssh running on the default port and a private key stored in the id_rsa file:

ssh -i user_id_rsa@hostname_or_ip

Note that if `id_rsa` is stored in the `~/.ssh` directory, you can omit it from the command. However, if you have multiple keys, you must use `-i {path_to_privkey}` to select a specific key.

ssh-agent

Important note: This does not work for Dropbear.


If you want to use an SSH agent to avoid typing passwords, Termux's Opensh package provides a wrapper script for ssh called "ssha" (note the "a" at the end) that:

  • Start the ssh agent if necessary (or connect if it's already running).
  • Run `ssh-add` if necessary.
  • Run `ssh` with the given arguments.

This means that the agent asks for a key passphrase on the first run, but remembers the authorization for subsequent runs.

Using the SSH server

OpenSSHGenericName

OpenSSH (also known as OpenBSD Secure Shell) is a set of secure network utilities based on the Secure Shell (SSH) protocol, which provides a secure channel over an unsecured network in a client-server architecture.

The default SSH port in Termux is 8022.

Start and stop the OpenSSH server

Since Termux does not use a startup system, services are started manually from the command line.


To start the OpenSSH server, you need to run this command:

sshd

If you need to stop `sshd`, just kill its process:

pkill sshd


The SSH daemon records the Android system log, you can see it by running itlogcat -s 'sshd:*'🇧🇷 You can do this in Termux or in ADB.

Configure password authentication

Password authentication is enabled by default. This will make it much easier for you to get started. Before proceeding, make sure that your password authentication is less secure than that based on a public key.


1. Make sure everything is up to date and the openssh package is installed:

openssh install pkg update package


2. Password authentication is enabled by default in the configuration file. But you can check anyway ($PREFIX/etc/ssh/sshd_config), it should look like this:

(Video) termux using ssh remote access

PrintMotd yesPasswordAuthentication yesSftp Subsistema /data/data/com.termux/files/usr/libexec/sftp-server


3. Set a new password. execute orderclave🇧🇷 Although the program allows a minimum password length of 1 character, the recommended password length is more than 8-10 characters. Passwords are not printed on the console.

$ passwdNew password: Retype new password: Your new password has been set successfully.

Configure public key authentication

Public key authentication is the recommended method for logging in with SSH. To use this type of authentication, you need a public/private key pair. For a successful login, the public key must be present in the list of authorized keys on the remote computer, while the private key must be kept safe on your local host.


The following example assumes that you want to set up public key authentication between your PC (host) and your Android device using Termux (remote). It also assumes that you are running a Linux distribution on your PC.


1. If you don't have keys, you can generate them. In this example we will generate an RSA key. Run this command on the PC:

ssh-keygen -t rsa -b 2048 -f id_rsa

The command shown above generates a private RSA key with a key length of 2048 bits and stores it in the "id_rsa" file. In the same directory you will find a file `id_rsa.pub` - it is a public key.

Important note: 2048 bits is the minimum key length considered secure. You can use higher values, but don't use more than 4096 as the remote server may not support large keys.


2. Copy the key to the remote computer (Termux). Password authentication must be enabled to install Pubkey on a remote computer. Do it now:

ssh-copy-id -p 8022 -i id_rsa IP_ADDRESS

Don't forget to replace "IP_ADDRESS" with the actual LAN IP address of your device. It can be determined with the commandifconfig.

  • Alternatively, you can manually copy the content to id_rsa.pub (public key) which is already on the PC and looks like thisssh - rsa < TOO MANY RANDOM CHAIRS > user@hostand paste it into termux file$HOME/.ssh/authorized_keys(remote machine) Remember to connectssh user@<IP_Phone> -p 8022Then you can copy the content of the public key and paste it into Termux using any text editor available on the PC.

If all is well, you will see a message like this:

Number of keys added: 1 Now try accessing the computer with: "ssh -p '8022' '192.168.1.4'" and verify that only the desired keys are added.


3. From now on, password authentication can be disabled. Edit the $PREFIX/etc/ssh/sshd_config file and replace the line starting with "PasswordAuthentication" with

Password Authentication No

Then run the commandpkill sshd; sshdto reboot the server with the updated configuration file.

autumn berries

Dropbear is a software package written by Matt Johnston that provides a Secure Shell compatible server and client. It is designed to replace the default OpenSSH in environments with low memory and processor resources, such as embedded systems.


Important note: Dropbear does not provide an SFTP server.

Start and stop the Dropbear server

As with OpenSSH, you have to run the binary manually. Also, unlike OpenSSH, Dropbear doesn't use a configuration file, just command line arguments.

(Video) How to use ssh in Termux | Secure Shell


The server runs in the background, with password and public key authentication available. To achieve this, simply type in the console:

bear drop


If you only need public key authentication, do the following:

dropbear-s


The server can also be started in the foreground. To do this, use a `-F` parameter:

Fallberry -F


The server started in the foreground can be stopped simply by pressing Ctrl-C. If it's in the background, you can use a `pkill`:

pkill dropbear

Configure password authentication

As with OpenSSH, password authentication is enabled by default.

All you have to do is:


1. Make sure everything is up to date and Dropbear is installed:

pkg package update install dropbear


2. Set the password by running the commandclave.


3. Start the Dropbear server. You can easily run bothbear dropto run it in the background orFallberry -Fto launch it in the foreground.

Configure public key authentication

Just like with OpenSSH, you can store your keys with it.ssh-copia-id🇧🇷 But if you're thinking of configuring Termux's public key authentication for something else, it's worth mentioning a few key differences between OpenSSH and Dropbear.


1. Dropbear uses a different command to generate keys. Example of generating an RSA key (2048 bits):

dropbearkey -t rsa -f id_rsa -s 2048


2. The public key must be obtained manually. To do this, you need to use 'dropbearkey' again, but in a different way:

dropbearkey -f id_rsa -y


3. Dropbear and OpenSSH use different key formats. To use a Dropbear key in OpenSSH, you need to convert it:

dropbearconvert dropbear abresh ./id_rsa ./id_rsa_openssh

This process can be done in reverse to get a key in Dropbear format:

(Video) Warning! Android phone remote control // Hackers can hack your phone

dropbearconvert abre sh dropbear ./id_rsa_openssh ./id_rsa_dropbear

con SFTP

The OpenSSH package provides a tool to access remote hosts via SFTP. This allows you to work with files in the same way as FTP, but more securely.


Connection to Termux (sshd is listening on port 8022):

$ sftp-P 8022 192.168.1.20


Connection to another location (sshd is listening on the default port):

$ sftp sftp.beispiel.com


However, to use the SFTP client command line, you need to know a few basic commands:

  • CDPATH: Change the current directory to "PATH".
  • to receiveREMOTE [LOCAL]: Download the file "REMOTE" and rename it to "LOCAL" (optional).
  • mkdirPATH - Creates the "PATH" directory.
  • ls[PATH]: Lists the files in the `PATH` directory. If no arguments are present, the files in the current directory will be listed.
  • place, putLOCAL [REMOTE] - Load the file "LOCAL" and rename it to "REMOTE" (optional).
  • rmFILE - Deletes the "FILE" file.

This is not an exhaustive list of SFTP commands. To see all available commands, you should refer to the man page (mann sftp) or view brief help in an interactive SFTP session by issuing the help command.

Mosh is a remote terminal application that enables roaming, supports bursty connectivity, and provides intelligent local echo and line editing of user keystrokes.

application example

Important note: Mosh must be installed on the client and server side.


Connect to remote host (sshd listens on default port):

user mosh@ssh.example.com


Connection to Termux (sshd is listening on port 8022):

mosh --ssh="ssh -p 8022" 192.168.1.25

Rsync is a tool for synchronizing files with remote hosts or local directories (or drives). For the best rsync experience, make sure the openssh (or dropbear) package is installed.

application example

Sync your photos to PC:

$ rsync -av /sdcard/DCIM/ user@192.168.1.20:~/Images/Android/


Get photos from a remote Android device:

$ rsync -av -e 'ssh -p 8022' 192.168.1.3:/sdcard/DCIM/ /sdcard/DCIM/


Synchronize local directories (for example, from an external SD card to Termux Home):

$ rsync -av /storage/0123-4567/myfiles ~/files


You may want to see the manual page (`man rsync`) for more information on how to use it.

(Video) Ghost Framework | Control Android Devices Remotely

Access to Termux over the Internet

Connect to Termux with SSH over USB

FAQs

How do I enable GUI in termux? ›

If you want to use overlay windows or be able to open windows from the background, go into the app settings for Termux:GUI, open the advanced section and enable "Display over other apps".

How to connect VNC to termux? ›

Download and install Termux in Android.
...
In VNC Viewer, press the + button in the lower right corner.
  1. Under Address type localhost:5901 .
  2. Under Name type any name that you want to show in the app.
  3. Press Create. An Entry by the name you entered will appear.

Why is termux not working? ›

Note: Since November 2022, the Google Playstore has refused to accept updates from Termux, so downloading Termux from there won't work.

Can you code in termux? ›

Yep termux is a Linux terminal emulator for Android. It is basically a small Linux on your phone. Obviously you can code in termux.

What is x11 in Termux? ›

A Termux add-on app providing Android frontend for Xwayland.

How do I allow all permissions in Termux? ›

Android 11
  1. Go to Android Settings --> Applications --> Termux --> Permissions.
  2. Revoke Storage permission.
  3. Grant Storage permission again.

How do I use Termux x11? ›

Building packages
  1. Enter build environment (will download docker image if necessary): cd ./x11-packages ./start-builder.sh.
  2. Choose package you want to build and run: ./build-package.sh -a ${arch} ${package name} Replace ${arch} with target CPU architecture and ${package name} with package name you want to build.

How do I set up Termux boot? ›

Usage
  1. Install the Termux:Boot app.
  2. Go to Android settings and turn off battery optimizations for Termux and Termux:Boot applications.
  3. Start the Termux:Boot app once by clicking on its launcher icon. ...
  4. Create the ~/. ...
  5. It is helpful to run termux-wake-lock as first thing to prevent the device from sleeping.

What is PRoot in Termux? ›

PRoot is a user-space implementation of chroot, mount --bind, and binfmt_misc.

Can Termux work on unrooted phone? ›

Installing Termux

Termux is an Android terminal emulator and Linux environment application that works directly with no rooting or setup required.

Can Termux work without root? ›

It can run on both rooted & Non-rooted devices!

Which Termux is best for Android? ›

Best Termux Tools For Ethical Hacking
  • Nmap.
  • Hydra.
  • Metasploit.
  • SQLmap.
  • Wireshark.
  • Social Engineering Toolkit.
  • Nikto.
  • Tool-X.

Can Termux run adb command? ›

Termux's directory which it will show you after you tape sy and push enter on the screen in terminal just after you grant it root. Then you use an otg cable and connect two Android devices together throw files in Termux's directory and send fastboot and adb commands whenever.

How do I access the root directory in Termux? ›

Steps to enable access to $HOME are same as for any external drives: open storage manager --> select drive (Termux) --> Select root directory of storage. Alternate way would be direct access to Termux home directory with Superuser permissions. That's possible only on rooted devices.

What is Ruby in Termux? ›

Ruby is a dynamic, open source programming language with a focus on simplicity and productivity. It has an elegant syntax that is natural to read and easy to write. In Termux Ruby can be installed by executing pkg install ruby. Due to our infrastructure limits, we do not provide older versions of packages.

How do I allow external apps in Termux? ›

You can grant Termux the Draw Over Apps permission from its App Info activity Android Settings -> Apps -> Termux -> Advanced -> Draw over other apps .

How do I activate X11? ›

AIX X11: How to enable X11 forwarding with SSH
  1. Software Requirements:
  2. To configure the AIX Server:
  3. 2) Stop and restart the SSH daemon:
  4. #stopsrc –s sshd. ...
  5. 3) Install, and start the Xserver and PuTTY software on the PC.
  6. 4) Start, or restart the PC Xserver (Xming).
  7. 5) Configure and start the PC terminal emulator (PuTTY)
Jun 5, 2021

How do I activate X11 forwarding? ›

Solution
  1. Step 1: Install required X11 packages. ...
  2. Step 2: configure X11 forwarding. ...
  3. Step 3: Configure putty and Xming to perform X11 forwarding connect and verify X11 forwarding. ...
  4. Step 4: Configure the EC2 Linux session to forward X11 if you are switching to different user after login to run GUI-based installation / commands.
Oct 5, 2020

How do I give permission to full user? ›

Setting Permissions
  1. Access the Properties dialog box.
  2. Select the Security tab. ...
  3. Click Edit.
  4. In the Group or user name section, select the user(s) you wish to set permissions for.
  5. In the Permissions section, use the checkboxes to select the appropriate permission level.
  6. Click Apply.
  7. Click Okay.
Sep 9, 2022

What are 755 permissions? ›

755 - owner can read/write/search, others and group can only search. Common permissions settings: 777 - directories with proper permissions on files in directory, use this one very carefully.

What are 750 permissions? ›

Therefore, 750 means the current user can read, write, and execute, the group cannot write, and others cannot read, write, or execute. 744 , which is a typical default permission, allows read, write, and execute permissions for the owner, and read permissions for the group and “world” users.

What can I do with Termux API? ›

* Read and send sms messages from your terminal. * Access device GPS location sensor from scripts. * Pipe the result of commands into the device text-to-speech engine. * Vibrate the device when something interesting happens.

What is the use of Termux boot? ›

termux allows programs to be run at boot. Instructions: * Start the Termux:Boot app once by clicking on its launcher icon. * This allow the app to be run at boot.

Is Termux like CMD? ›

Termux is an open-source terminal emulator application that works on Android devices. It also works as a sort of mini Linux OS, packed with many tools and utilities you commonly see in desktop Linux distributions. You can use Termux to install and run numerous command-line apps through its own package manager.

What is Termux Wakelock? ›

termux-wake-lock and termux-wake-unlock can be used to trigger a wakelock which causes Android not to go into deep sleep. Since the default login shell is bash; it could be useful to call termux-wake-lock in your ~/. profile (or ~/. bash_profile where appropriate) and termux-wake-unlock in your ~/.

How do I use Termux as a launcher? ›

Build
  1. Make sure you have cloned this repo to your local storage.
  2. Make sure you have located on root directory of this repo.
  3. Make sure build.sh on this root repository has executable permission. run this script on root directory of this repository:

What is command Termux? ›

The Termux app provides a command line environment and allows you to install honest-to-goodness Linux apps on your Android device.

How does chroot work? ›

A chroot (short for change root) is a Unix operation that changes the apparent root directory to the one specified by the user. Any process you run after a chroot operation only has access to the newly defined root directory and its subdirectories.

What is public key in Termux? ›

Assuming it was the very first time you used the ssh-copy-id command, the Termux public key is going to be the last line in that file. Otherwise you can quickly compare the keys using the following in Termux: cat .ssh/my_secret_key.pub. Then you can find the key you wanted in the authorized_keys file.

Is Termux rooted? ›

“Termux is an Android terminal emulator and Linux environment app that works directly with no rooting or setup required. A minimal base system is installed automatically - additional packages are available using the APT package manager."

Can you root Android with Termux? ›

Yes, it is possible to root an Android phone using the Termux app. However, rooting your phone involves modifying the operating system and can potentially compromise the security of your phone.

What is fish in Termux? ›

From Termux Wiki. FISH is a smart and user-friendly command line shell for macOS, Linux, and the rest of the family. The FISH shell init files are ~/. fish , $PREFIX/etc/fish/config.

How much RAM does Termux use? ›

Be prepared that Termux uses much of internal storage, you are dealing with packages ported from Linux distributions. That's 500 MB - 5 GB typically, in some cases more... Everything depends on your use cases.

Can I install Python on Termux? ›

A few python packages are available from termux's package manager (for python3 only), and should be installed from there to avoid compilation errors. This is the case for: numpy, pkg install python-numpy. electrum, pkg install electrum.

How to root Android phone without PC? ›

Step 1: Download the King Root apk on your phone and install it by following the on-screen instructions. Step 2: Launch the app and hit the One Click Root button to trigger the rooting action. Wait until the rooting progresses on the phone.

Can iPhone run Termux? ›

Requires iOS 14.0 or later. Compatible with iPhone, iPad, and iPod touch.

Is Termux a VM? ›

Also, Termux is a terminal emulator which runs a small Linux VM, which supports apt to install packages. This works without a rooted android phone.

Is F-Droid safe Termux? ›

Is it safe? F-Droid is entirely open-sourced and has millions of eyes monitoring the source code of the apps submitted. It has strict compliance for the app submissions, and a zero-tolerance for Google APIs.

Can I use SSH on Termux? ›

Termux provides SSH via two packages: dropbear and openssh. If you never used these tools before, it is recommended to install 'openssh' as it is more common.

How do I get git on Termux? ›

This is done from the Google Play Store, by following these steps:
  1. Open the Google Play Store on your Android device.
  2. Search for Termux.
  3. Locate and tap the entry by Fredrik Fornwall.
  4. Tap Install.
  5. Allow the installation to complete.
Aug 13, 2019

Does Termux have Git? ›

We can use Git in our Android mobiles with the help of Termux. Sometimes we need to work with Git but at that time we may need a laptop to work. So we can use Git in our Android mobiles also using the tool Termux.

How do I access root command? ›

How to get root access on Linux operating system?
  1. Please click on the lower left corner of the icon (start button).
  2. Click Terminal menu item to open the terminal.
  3. Input the command below: % sudo su –
  4. Press Enter.
  5. Your terminal prompt will become #.
  6. You now have root privleges on all operations in the terminal window.

How do I access root user on Android? ›

Rooting with Framaroot

Install it — you may need to tap the Unknown Sources button in your Android Security settings to complete the installation. Open the app, and tap Root. If it can root your device, you can root your device. You then must download and run Magisk to manage your root access.

What is Figlet in Termux? ›

What is figlet. Figlet is a open source and free tool which is provide number of fonts for text. It is used for linux terminal like kali, Ubuntu ,parrot and you can used in termux.

Is Termux full Linux? ›

Termux is Linux, but it is based on Android and runs in a container. That means you can install it with no root access required—but it also means it may take some getting used to.

Is Ruby more powerful than Python? ›

A close-up of Ruby vs. Python side-by-side shows that in some choice areas like machine learning, documentation, and ease of learning, Python actually performs better than Ruby.

How do I install GUI mode? ›

How to Install a Desktop Environment/GUI in Ubuntu Server
  1. Step 1: Update and Upgrade Your System. This is a fundamental step before making any changes or installing packages into your Ubuntu server. ...
  2. Step 2: Install the Desktop Environment. ...
  3. Step 3: Install and Set Up a Display Manager.
May 6, 2022

How do I change the GUI on my phone? ›

Step 1
  1. Launch Settings.
  2. This can be done by Tapping the Settings button from the App Drawer. ...
  3. Tap Applications.*
  4. Tap Manage applications.
  5. Press the Menu button and then Tap Filter.
  6. Tap All.
  7. Tap Clear defaults.
  8. Press the Home button and then Tap Use by default for this action.
Jun 16, 2022

How is GUI used on phones? ›

Having a GUI makes it easy for the user to understand and activate features. The GUI makes it easy to check to see if how many voice mails you have, add names to your contact list, and call SIP addresses, among other features.

What is GUI on phone? ›

A graphical user interface (GUI) refers to the way users interact with computers, cell phones and other modern devices.

What does GUI mode mean? ›

The GUI (/ˌdʒiːjuːˈaɪ/ JEE-yoo-EYE or /ˈɡuːi/ GOO-ee), graphical user interface, is a form of user interface that allows users to interact with electronic devices through graphical icons and audio indicator such as primary notation, instead of text-based UIs, typed command labels or text navigation.

What are 3 GUI examples? ›

GUI examples include computer monitors, smartphones, tablets, gaming systems, or other consoles.

What are three types of GUI? ›

A GUI program consists of three types of software:
  • Graphical Components that make up the Graphical User Interface.
  • Listener methods that receive the events and respond to them.
  • Application methods that do useful work for the user.

How do I start python GUI? ›

If you're new to creating GUI's in Python the basic steps are to:
  1. Import the Tkinter module: import Tkinter, top = Tkinter.Tk()
  2. Create the GUI main window that will “house” your GUI and widgets.
  3. Add whatever widgets your GUI needs including buttons, labels, lists etc.
Mar 14, 2022

Can I get root access with Termux? ›

You don't need to install any other OS to gain the root privileges in your termux. This tool(ROOT) is specifically made for termux and termux users. This tool will also help you to gain the look of Kali-Linux in your termux with root access.

How do I allow access to APK? ›

Android 8 or above

On your device, tap Settings > Apps. Tap Special access > Install unknown apps. Tap the browser from where you will download the APK, such as Chrome. If prompted, toggle Allow from this source on.

Which Android UI is best? ›

6 Best Android Phone UI and Skins (2023)
  • One UI: Samsung's Own Android Skin, Loved By Many.
  • Best Samsung Smartphones with One UI.
  • ColorOS: One of the Best Looking and Most Feature Full UI.
  • Best ColorOS Smartphones 2023.
  • MIUI: Most Favourite and Hated UI.
  • Best Xiaomi or Redmi or POCO Smartphones 2023.

Videos

1. WIKI-TERMUX | Guida interattiva per l'uso del terminale Linux
(Tigerman Root)
2. Getting remote access to PC with Android | HID attack | Metasploit | Android Termux
(Android Infosec)
3. how to remotely access any one phone on android termux IN HINDI ##part-2
(Techno HACKERS)
4. How to hack phone call and sms from termux app in android mobile {Tutorial} ||
(HACKING VERSE)
5. Remotely monitor an android device [Hindi]
(TechChip)
6. watch how Hackers Remotely Control Any phone?! protect your phone from hackers now!
(Loi Liang Yang)

References

Top Articles
Latest Posts
Article information

Author: Dr. Pierre Goyette

Last Updated: 09/14/2023

Views: 6696

Rating: 5 / 5 (70 voted)

Reviews: 85% of readers found this page helpful

Author information

Name: Dr. Pierre Goyette

Birthday: 1998-01-29

Address: Apt. 611 3357 Yong Plain, West Audra, IL 70053

Phone: +5819954278378

Job: Construction Director

Hobby: Embroidery, Creative writing, Shopping, Driving, Stand-up comedy, Coffee roasting, Scrapbooking

Introduction: My name is Dr. Pierre Goyette, I am a enchanting, powerful, jolly, rich, graceful, colorful, zany person who loves writing and wants to share my knowledge and understanding with you.