GAINING ACCESS TO /System/bin/sh WITHOUT Rooting device - android

I am trying to gain root access to an android device and every time I run adb root or adb su i get an error /system/bin/sh: adb: inaccessible or not found.
I want to be able to access this folder without actually having to root the device. Is there any way I can do this?

Set up your environment for building Android devices by running the following command from the root of your source code checkout:
source build/envsetup.sh

Related

Running adb as root from an Ubuntu machine

I'm trying to modify the hosts file on my android phone and I am using adb for this on Ubuntu 20.04 to pull the file, modify it and push it back as suggested here. I was able to pull the file but when I try to push it I get an error
adb: error: failed to copy 'Documents/hosts' to '/system/etc/hosts': remote couldn't create file: Read-only file system
One suggestion seems to be to run adb remount or adb shell mount -o rw,remount /system (I'm not sure if these meant to be run on the android device itself) and this doesn't work for me, I get
/system/bin/sh: /system/bin/remount: inaccessible or not found
To this, there seems to be a suggestion to run adb root which returns adbd cannot run as root in production builds. Now I'm not sure how to proceed. There are some threads online saying what to do about this but I feel this is way above my head already. I just want to push the hosts file back to the phone. Is there a simple way to do this?

adb root Permission denied

hi i was reading a guide about frida tool and how to us it and it work fine on a simulator
but now i am Trying to us this tool on my pone i am stuck because i cant get access to the root
my code is:
127|tulip:/ $ su root
/system/bin/sh: su: not found
127|tulip:/ $ root
/system/bin/sh: root: not found
127|tulip:/ $
this is the command i used is su root and it work on the simulator soo why it don't work on the real phone?
127|tulip:/ $ cd root
/system/bin/sh: cd: /root: Permission denied
2|tulip:/ $
also didn't work. if someone already asked it sorry I didn't see
The reason is simply that physical devices don't allow root access by default.
Some devices can be bootloader unlocked and then rooted (eliminates your warranty).
Some devices can be hacked to get root and on some devices it is next to impossible to gain root permissions.
In general the process for rooting a device varies by device. Check xda-developer forums specific for your device for learning how to root your device.
As part of the rooting process the necessary modifications are made to the system and then su binary is available.

Is it possible to Root Visual Studio Emulator Android?

I am currently using 'Visual Studio Emulator for Android' to run android apps on my computer, i find that after using multiple types of emulators bluestacks, genymotion, andy etc. That VS is the most stable and easy-to-use out of them all.
The only problem that i have compared to the other emulators is running apps that require root permission, with this being an emulator i know that its not possible to go the route of rooting via fastboot/recovery, this is the only method i know of rooting as thats how i normally do it on my phone.
I have tried most of the 'rooting' APK's (kingo,towel,frama etc) and none of those have worked.
So would anybody happen to know how i can get root access on Visual Studio Android Emulator?
I am trying to run a touch-replication app (Frep & RepetiTouch) but all of them seem to require root access.
Any advice would be much appreciated. Thanks
Yes, you can. Here are some basics before the steps. Fundamentally all Visual Studio Emulator has root access; if you do adb shell you will get a root prompt. The only thing that is missing is the su binary and access for applications to connect to root shell through su. You can get the su binary from superuser apk from clockworkmod and the access to the root shell through the su daemon.
Installing su binary
Download superuser apk from clockworkmod. Ideal way is to download the app from google play store and navigate to /data/app/ and copy com.koushikdutta.superuser to your pc through adb pull /data/app/com.koushikdutta.superuser <local_path_in_your_system>
Change the .apk extension to .zip.
Navigate to assets/x86/ and copy the su binary to /system/xbin in your emulator
adb push <location_of_su> /system/xbin
chmod with suid and rwx
adb shell
chmod 6777 /system/xbin/su
symlink to /system/bin
ln -s /system/xbin/su /system/bin/su
Run the su daemon
/system/xbin/su --daemon
Giving Access to Applications through su
Install the superuser binary by either dragging and dropping into
the emulator or using adb install <path_to_superuser_apk>
Download rootchecker free\basic or even a terminal emulator for that
matter. We just want to check if our device is rooted.
Run the rootchecker app to check root and you should be able to get
the prompt from superuser.

Directory manipulation without root access

I am working on an automation solution and as part of my code, I have to create a directory.
I used to do adb shell mkdir /data/data/com.apkname/files/ following an adb root command.
However, when I try to do it without adb root, it does not seem to be working. Some of the production Android devices have root disabled. I am trying to figure out how to do it without Root access. Is is possible?
You can use the run command with as as follows
adb shell
$ run-as package.name
Now that you will reach inside the specified application's data folder with all access.

Am I rooted or not?

I am trying to figure out if my Android device is rooted or not. The Superuser app is no where to be found. In a terminal emulator on my phone, I can't type the command su, and the command id reports that I'm not root. However, when I use the adb shell, I have full root access to the phone, which is confusing to me. Does this mean I'm rooted, or not?
I believe the build you are using is either debug or userdebug.
In this case apps cannot get root access since su is not present. Only ADB_SHELL will get root access.
You can push precompiled su to /system/bin after executing a adb remount
Edit: If you want root access from apps then follow this thread

Categories

Resources