Is there any way to call the share menu in a termux script?

I made a bash script for termux and at the end of it i want to call the share menu to send a file made by my script by whatsapp for example

I really don’t have any idea about how to do this.

Any help is appreciated :]

Termux – help to installing the boostrap packages

Termux is say unable to install the bootstrap packages in itel 1516 plus pls help me.

file permissions – Cxxdroid can execute c++ binary in any internal storage directory, but Termux cannot

I was testing some c++ executable in my old smartphone (Android 8). Here’s the description of the problem:

I have both Termux and Cxxdroid installed in that phone. And in termux, I have clang installed.

Let’s enter Termux.

cd /storage/emulated/0/c++    # current dir is now c++ which sits in the internal storage
ls    # this prints 'hello.cpp', a simple hello world program. let's compile it.
clang++ hello.cxx -o hello
ls    # this prints two files now, hello and hello.cxx. let's execute hello.
./hello    # prints: bash: ./hello: Permission denied. let's grant permission.
chmod +x hello
./hello    # prints: bash: ./hello: Permission denied

As you can see, there’s no way I can execute hello in the c++ directory. I know that if I move hello in $HOME and run it, it would work right away. But that’s not the case.

Now, let’s enter Cxxdroid.
Enter ‘Terminal’ from left menu. Let’s execute our hello binary.

cd /storage/emulated/0/c++
ls    # contains two files. hello.cxx and hello (which is the binary generated from Termux clang). let's run it.
./hello    # prints 'Hello World'

See? The same binary does not run in Termux but runs right away in Cxxdroid. Why? What technique is Cxxdroid using under the hood? Permission of the hello binary for both Termux and Cxxdroid is:

ls -l hello    # prints: -rw-rw---- 1 root everybody 115588 Apr 25 00:32 hello

Any help is appreciated.

usb – Boot Linux from stick in Termux

This question explains in detail why it’s basically impossible to boot Linux from a USB stick.

But I am still wondering: is it possible to load and “boot” a stick-bound Linux distro from a USB stick using the Termux terminal app? It can already access files from sticks and run other distros like Arch, so I’d imagine it to be quite possible.

I’m open about the specifics. I’ll take whatever distro works.

The idea is to setup a stick-bound persistent Linux instance for specific tasks. I want to run this Linux both on PC and android through the same USB-Stick, although I’d settle for an android-only solution at this point.

installation – Put Termux environment on external SD card

Following this answer, I formated my sdcard as ext4-fs.

Then tried mounting the sdcard into termux home as the link above says

mount /dev/block/mmcblk1p2 /data/data/com.termux/files/home/ext4-fs

I get error mount: bad /etc/fstab: No such file or directory

I could only mount the partition with root using su command, only then the mount command doesn’t give error.

Mounting the partition with su from terminal or with app like Link2Sd (which also uses root) makes the mount point (i.e where the partition is mounted) unreadable for Termux.

What am I missing?

He (the author of the answer above) even went further to create a symlink to Termux $PREFIX using another terminal app which is impossible without root also as thus also not readable by Termux which even complicates everything

I think this should be possible, what am I doing wrong pls

proxy – how can I direct all network traffic on my devices to 127.0.0.1 with a specified local port on an ssh that I setup on a separate android using termux?

So far, I have only been able to do the following steps:

Install openssh on termux.

pkg install openssh

Then I turned on hotspot on my phone.

Then I found the phone’s ip address using ifconfig which was 192.168.126.176 and user name by whoami which was u0_a195 on termux.

I setup the password on termux by typing passwd.

Then I ran sshd -dD on termux.

Then I connected my windows 10 pc wifi to the hotspot and opened CMD.

ssh -D 8123 -fqgN u0_a195@192.168.126.176 -p 8022

I typed up the password that I already setup to ssh in.

From here nothing else happens on the CMD

In termux, it said accepted password for u0_a195 from 192.168.126.69 port 60353 ssh2

Then I go to settings on windows10 global proxy settings and select manual proxy.
I set it up as 127.0.0.1:8123

I then tried to connect to the internet on the PC but it didn’t work.

What am I doing wrong?

permissions – How to run Termux commands from adb

I am trying to run the tshark command I have set up in Termux from the adb shell. I set up termshark by running the following commands:

pkg install root-repo
pkg install termux-api
pkg install termshark

After running those I was able to just run tshark as a command in Termux. I am now trying to run the tshark command through an adb shell. tshark is located at /data/data/com.termux/files/usr/bin/tshark but when I try to run that in adb I get a message saying the following

1|generic_x86_arm:/ $ /data/data/com.termux/usr/bin/tshark    
/system/bin/sh: /data/data/com.termux/usr/bin/tshark: inaccessible or not found

My Android device is not rooted, is there a way to access this command without rooting my device?

linux – Is it possible to run an X Server and a window manager in TermUX

I am running the TermUX application on an Android 10 smartphone, and can type in it with my Logitech K480 keyboard. I want to run a window manager like fvwm (see fvwm.org).

I have found an article on the internet which seems to mention i can run VNC server and client or XSDL although the latter is unstable, but as far as I understand I can only do this if i have a separate computer running the server, and then my Android smartphone can run the client window manager from TermUX after changing the DISPLAY environment variable

Is this correct?

How can I run an X Server in TermUX and then simply run the window manager with the startx command like in Linux?

Thanks.

permissions – How to run tcpdump on termux?

I can have tcpdump binary installed, but my (android) OS is not rooted.

So if I try to run it on termux:

$tcpdump -ni any tcp and port 12345
tcpdump: wlan0: SIOCETHTOOL(ETHTOOL_GLINK) ioctl failed: Permission denied

The binary owner was root and was located in /data/data/com.termux/files/usr/bin/tcpdump so I decided the root privilege won’t be necessary after I mv it to my home directory. After which the owner is me, and the mod of the binary is:

-rwxrwxr-x 1 u0_a236 everybody 836K Feb  8 13:24 tcpdump

but even with the ownership, the same permission error.

So is there a way to bypass permission on not-rooted devices?

OS details:

$uname -a
Linux localhost 4.9.112-perf+ #1 SMP PREEMPT Tue Nov 17 00:51:35 WIB 2020 aarch64 Android

device name: Redmi
device model: Redmi 7
MIUI version: MIUI Global 11.0.11 Stable
Android version: 9 PKQ1.181021.001

Can Termux adb push file from unrooted phone to tablet via OTG cable?

Can I use Termux to send an app (APK file) via, e.g., adb push, from my unrooted Samsung Galaxy S10 phone to an unrooted Android 5.1.1 tablet via an OTG cable?