-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
access from adb shell? #77
Comments
|
You need the Another solution could be to start |
|
thanks! maybe a section in the help pages could be added for this? |
|
@fornwall anyway to make chroot work? |
|
That's what I got so far (on my rooted phone):
#!/system/bin/sh
export PREFIX='/data/data/com.termux/files/usr'
export HOME='/data/data/com.termux/files/home'
export LD_LIBRARY_PATH='/data/data/com.termux/files/usr/lib'
export PATH="/data/data/com.termux/files/usr/bin:/data/data/com.termux/files/usr/bin/applets:$PATH"
export LANG='en_US.UTF-8'
export SHELL='/data/data/com.termux/files/usr/bin/bash'
cd "$HOME"
exec "$SHELL" -l
#!/system/bin/sh
su $(stat -c %u /data/data/com.termux) /data/data/com.termux/files/home/bin/termux-shell.shFrom my laptop:
|
|
I tried following @gene-pavlovsky tip, but I can't use anything network related from that user. Just to be clear, I run:
Using LineageOS 14.1 (Android 7.1.1). |
|
I have the same network problem as @andresmrm. Is there any solution to this? |
|
i have the same problem, TERM=dumb, any fix for that? Tab, Ctrl-R, Ctrl-D etc. don't work |
|
@andresmrm & @nakovdev: This is probably a 'su' bug, the groups get dropped. From a termux shell: Using adb shell / su to change to u0_a77: \\ IME, adb shell is rather flaky and using ssh works much better. You can forward the sshd port over USB, using adb port forwarding: |
|
@tni's link has been moved here: https://glow.li/technology/2016/9/20/access-termux-via-usb/ |
|
not sure if forwarding a port over adb is better than just ssh over usb tether |
I have a similar output when I run "id" in a termux shell: but the interesting part comes when I run "id" passing the termux user in the termux shell: The user is not part of the "inet" group and that's why we are experiencing network problems. |
The necessary groups (like |
|
Thank you @xeffyr for the explanation. All this means that there will be no easy fix for this issue. |
|
@anarcat if you want to enter termux from computer, why not install ssh package in termux and just ssh from computer. You would have everything working. May I know what do you want to achieve doing so? |
|
i did not want to have to setup network and a daemon to access the tmux facilities. |
|
You need not require big setup etc. You can do everything with a quick and simple one time setup. Here is my setup
from now on, whenever you want to ssh, open termux in mobile and type sshd. And then from laptop you can login either via portward using adb or wifi Tip: I installed termux shortcuts app which will show me scripts in a simple widget. So I created a file with 1 line content and named it start ssh. Created another one with content and named it stop ssh |
|
In my case, I wanted to send command in the termux contest from a remote server with the least (possibly no) user interaction and client side configuration. @sultanahamer your solution doesn't require complex configurations and it's definitely cleaner than the one I was working on, I think I will use yours :) |
|
@Gia90 for "In my case, I wanted to send command in the termux contest from a remote server with the least (possibly no) user interaction and client side configuration" |
|
Thanks :) I will also consider this as a possible alternative. |
Thanks @gene-pavlovsky for the steps. To fix the issue mentioned above, I executed su -l $(stat -c %u /data/data/com.termux) -c /data/data/com.termux/files/home/bin/termuxshell
|
Is there a way to assign this group while switching users? I've looked high and low, can't seem to come across a solution. My goal is to start |
|
@verboze why not try scrcpy if you have a broken screen. It would help you get everything done. |
|
@sultanahamer I did NOT know about this tool! thanks a bunch, I'll give it a try! Edit: worked like a charm! Thanks for the tip sultanahamer! |
|
@verboze you can try adb over wifi using command |
on my phone adb shell
su
mkdir ~/.ssh
mkdir: '//.ssh': Read-only file systemcannot config authorized_keyscan run this code on phone to copy key ssh user@linux_clinet "cat ~/.ssh/id_rsa.pub" >> ~/.ssh/authorized_keysactually the absolute path is vi /data/data/com.termux/files/home/.ssh/authorized_keys |
@foxundermoon Termux gives you a much more powerful shell (it is very close to a standard linux shell). You have many more tools and can install even more or compile your own. That is the whole point of termux. The whole point of this issue/thread is that users are trying to use the adb shell as a starting point to remotely access the power of termux. Another, far more common, method of remote termux access is via ssh, but that is not what is being discussed here. Follow the termux wiki instructions to set up ssh - @sultanahamer's (very correct) comments are just to illustrate that setting up ssh is easy. But you have to know what "~" means and where to "adb push" a file and how to set its permissions and ... |
Alternative method ROOTOn my rooted phone (running LineageOS), I always use the Running tsu - a wrapper for su for Termux
Usage: tsu [-a|-e|-p|-s <shell>]
-s [</path/to/shell>]
Use an alternate specified shell. `//usr` is expanded to $PREFIX.
-p
Prepend /system/bin:/system/xbin to PATH and /system/lib{64} to LD_LIBRARY_PATH.
-a
Append /system/bin:/system/xbin to PATH and /system/lib{64} to LD_LIBRARY_PATH.
-e
Setup up some enviroment variables as when in Termux.
For details of the options see:
https://github.com/cswl/tsu
|
|
tsu -e doesn't exist? @DRSDavidSoft |
|
As far as I understand it, As for tsu itself, |
How to fix: |
|
|
run adb shell as root: then: /sbin/su -c PATH=/sbin/.magisk/busybox env -i PREFIX=/data/data/com.termux/files/usr LD_PRELOAD=/data/data/com.termux/files/usr/lib/libtermux-exec.so HOME=/data/data/com.termux/files/home/.suroot TMPDIR=/data/data/com.termux/files/home/.suroot/.tmp ANDROID_DATA=/data TERM=xterm-256color ANDROID_ROOT=/system PATH=/data/data/com.termux/files/usr/bin:/data/data/com.termux/files/usr/bin/applets:/system/bin:/system/xbin:/sbin:/sbin/bin /data/data/com.termux/files/usr/bin/bash |

is there a way to access the termux binaries from the ADB shell?
is there a way to enter the termux environment from ADB?
i thought chroot could work, but it doesn't either:
The text was updated successfully, but these errors were encountered: