[How to] Give root access to selected apps using adb shell. [Non-rooted, Android 10, Locked bootloader] Device:- Android One Xiaomi MI A3 - General Questions and Answers

I am trying to use an app which needs root access to my device. I don't want to root my device. My device is part of Android One project, so it has stock Android. Recently I have used ADB shell for giving root access to an app for using some live wallpapers. I found that thing on XDA.
Here's the link: https://www.xda-developers.com/download-asus-rog-phone-3-live-wallpapers/
I used this code-
Code:
adb shell pm grant space.linuxct.rogcontroller android.permission.WRITE_SECURE_SETTINGS
Now I need to give root permission to another app named Pokemod. This app is used for getting some extra features on Pokémon Go. Super SU or Superuser is not installed my phone. You can find that code as for a brand new stock Android phone. Nothing is edited on my phone except running that code & also I don't want to edit anything else related to system folder except using ADB shell. Please give me the ADB code for getting root access only for this app.
My device details:-
Device name: Xiaomi MI A3
Device code name: laurel_sprout
Android version: 10 (Updated from Android 9 Pie)
Root status: Non-rooted
Bootloader status: Maybe locked, I am not sure but I didn't did anything with it.
Device recovery: Official recovery from Xiaomi & Android One
Ram: 4 Gb
Rom: 64 Gb
Used for: Almost 8 months
Please help me as soon as possible. Thanks in advance.
#SMIGBONAP

You cant, WRITE_SECURE_SETTINGS is not root. To give root perm to an app you need magisk.

antoine62 said:
You cant, WRITE_SECURE_SETTINGS is not root. To give root perm to an app you need magisk.
Click to expand...
Click to collapse
Is there any other way to give root permission without magisk & if not then how to do it with magisk ?

Related

[ROOT][QUESTION] How can an app use root in an eng build?

I am writing an app for my Pixel that calls a binary that need root to run effectively. I am currently running an eng build that I build from aosp with root access (lunch aosp_saifish-eng). I am able to run my binary in root shell through adb. However, when I try to kick it off from an app that I wrote in Android Studio, I get a permission denied error. I am calling for root using this code:
Process rootProcess = Runtime.getRuntime().exec("su");
Is there a way for an app to use su without the help of a root management app like SuperSU? Perhaps my understanding of root is lacking. I would appreciate any help or direction as to where to go to learn more about why this is not working.
Slashazard said:
I am writing an app for my Pixel that calls a binary that need root to run effectively. I am currently running an eng build that I build from aosp with root access (lunch aosp_saifish-eng). I am able to run my binary in root shell through adb. However, when I try to kick it off from an app that I wrote in Android Studio, I get a permission denied error. I am calling for root using this code:
Process rootProcess = Runtime.getRuntime().exec("su");
Is there a way for an app to use su without the help of a root management app like SuperSU? Perhaps my understanding of root is lacking. I would appreciate any help or direction as to where to go to learn more about why this is not working.
Click to expand...
Click to collapse
Yes, adb. Just google for something like: adb grant root
Sent from my ONEPLUS A3003 using Tapatalk

Samsung Galaxy A7 (2018) rooting

Hello, I am a backend developer but still when it comes to Android, rooting, bootloading ecc. I am a perfect noob.
I tried to Root my Samsung Galaxy A7 (2018) in many ways but I always come back to the normal factory system.
TWRP glitches, shuts down the mobile (I cannot even unlock the screen and the reading permissions.
Are there any other options to root my device other than custom roms or recovery projects?
Any help is welcome.
If your device's Android is version 5 and higher then getting the superuser access to be able to control various aspects of Android OS means you need to perform a certain modification that will root your phone's Android and you will have access to the /system directory of your device.
Here is what you have to do to root your device's Android: Replace Android's Toybox binary - what is a restricted version by default - by unrestricted Toybox v0.8.5.
This can get achieved by means of ADB.
jwoegerbauer said:
If your device's Android is version 5 and higher then getting the superuser access to be able to control various aspects of Android OS means you need to perform a certain modification that will root your phone's Android and you will have access to the /system directory of your device.
Here is what you have to do to root your device's Android: Replace Android's Toybox binary - what is a restricted version by default - by unrestricted Toybox v0.8.5.
This can get achieved by means of ADB.
Click to expand...
Click to collapse
Well, how can I change the Toybox binaries in the system partition if my device is not rooted? As far as I know to do so the device must be already rooted.
You simply install a Tempory ROOT what's matching device's CPU-architecture
Code:
adb devices
adb push <PATH-TO-SUITABLE-SU-BINARY-HERE> /data/local/tmp/
jwoegerbauer said:
You simply install a Tempory ROOT what's matching device's CPU-architecture
Code:
adb devices
adb push <PATH-TO-SUITABLE-SU-BINARY-HERE> /data/local/tmp/
Click to expand...
Click to collapse
I will try this, thanks a lot

I want a complete guide on how to install android 10 on TB-X304L. OEM unlocking is greyed out and it shows an error if I try a method given by @hk96

The problem I have is that the 'enable OEM unlocking' option is greyed out on my tablet. I've tried this method but I keep getting this error. I didn't find anything helpful on the internet. Please help me if you can.
Look inside system file build.prop for entry
Code:
ro.oem_unlock_supported
If it's value is 0 then unlocking bootloader isnt supported.
If Android is rooted then you can try to change this entry to
Code:
ro.oem_unlock_supported=1
More info here:
Locking/Unlocking the Bootloader | Android Open Source Project
source.android.com
jwoegerbauer said:
Look inside system file build.prop for entry
Code:
ro.oem_unlock_supported
If it's value is 0 then unlocking bootloader isnt supported.
If Android is rooted then you can try to change this entry to
Code:
ro.oem_unlock_supported=1
More info here:
Locking/Unlocking the Bootloader | Android Open Source Project
source.android.com
Click to expand...
Click to collapse
Well I am unable to root with those 1 click rooting apps. Is there any other way to root it? The PC way is not gonna work because it needs twrp and twrp requires me to unlock OEM
To root a device's Android TWRP isn't needed at all: Rooting is the act of unlocking the Android OS to gain complete control over the device through which you can access hidden files, change the ROM or install certain special apps. Rooting Android OS simply means to add Superuser functionality to it.
Here is what you have to do to root your device's Android: Replace Android's Toybox binary - what is a restricted version by default - by unrestricted Toybox v0.8.5. This can get achieved by means of ADB.
jwoegerbauer said:
To root a device's Android TWRP isn't needed at all: Rooting is the act of unlocking the Android OS to gain complete control over the device through which you can access hidden files, change the ROM or install certain special apps. Rooting Android OS simply means to add Superuser functionality to it.
Here is what you have to do to root your device's Android: Replace Android's Toybox binary - what is a restricted version by default - by unrestricted Toybox v0.8.5. This can get achieved by means of ADB.
Click to expand...
Click to collapse
I am not a developer and new to all these things. I would appreciate if you could provide any video or article on how to do it. Thanks in advance!!
Shutupboomer said:
I am not a developer and new to all these things. I would appreciate if you could provide any video or article on how to do it. Thanks in advance!!
Click to expand...
Click to collapse
I was able to find this method of rooting through adb:https://forum.xda-developers.com/t/universal-guide-root-any-android-device-manually.2684210/
try it out and please reply if this method worked for you as i also want to try.
update: the rooting manually method didnt work. however, i found another way to get temporary root access on the lenovo tab 4 10. the lenovo tab 4 10 uses kernel version 3.18.71 which can be exploited by cve-2019-2215. download the zip i have attached and then copy the su98-memory-kallsyms file without the extention to /data/local/tmp if you want to do it through adb or to the /data/data/_________ folder where _______ is the terminal emulator you want to use with it and chmod it. then you can just do ./su98-memory-kallsyms and it will give you a root shell.
there is even an app included that does this and provides root access to all the apps. you can however whitelist some apps by puting them in the /data/local/tmp/su98-whitelist.txt. and the apps which werent allowed root access will be automatically put in the su98-denied.txt from where you can put them in the whitelist.
WARNING: this version of su98 was not specifically compiled for lenovo tab 4 10 and is a bit unstable. sometimes when performing a root task, it will freeze your tablet and you will need to restart. this is particularly annoying for me as my powr button is broken and i need to remove and reconnect the battery every time.

Vivo y33a

Hi everyone, I got a vivo y33s and wanted to ask if you can root it and if there are any custom roms
Every phone's Android can get rooted.
All you have to do is either to replace the pre-installed suite of Android shell commands ( AKA Toybox ) by a version what contains the su command or adding a suitable su binary to Android's filesystem, preferably to /data/local/tmp.
Whether a Custom ROM like LOS etc.pp. exists for this phone or not, IDK. GIYF ...
xXx yYy said:
Every phone's Android can get rooted.
All you have to do is either to replace the pre-installed suite of Android shell commands ( AKA Toybox ) by a version what contains the su command or adding a suitable su binary to Android's filesystem, preferably to /data/local/tmp.
Whether a Custom ROM like LOS etc.pp. exists for this phone or not, IDK. GIYF ...
Click to expand...
Click to collapse
Exist tutorial or guide for this?
I would also like to root my Y33s....
Can anyone please suggest a good (up to date) Tutorial for the ADB stuff.....or any other method for rooting?
greets
Yeah !
I also want to root Vivo y33t.
It is such a headache to watch all the adds, with root access I want to disable all the adds with energized protection. But, could not root this phone.
Expect some helps from XDA specialists here.
Thanks in advance.

How do I temporarily root a samsung device running android 9 without twrp recovery?

I have used magisk to patch the file and android platform tools (fastboot or stuff like that) but it does not work. I dont want to install twrp as i dont really trust custom recoveries as much and i dont want to use odin for the same reason. Is this impossible or is there a way but i am just doing it incorrectly. Please reply asap!
Never installed Magisk nor TWRP, why should I have done it?
To answer your question: A temporary root can get achieved by putting a suitable su into directory /data/local/tmp and making it executable.
https://forum.xda-developers.com/attachments/su-binaries-zip.5566949/
xXx yYy said:
Never installed Magisk nor TWRP, why should I have done it?
To answer your question: A temporary root can get achieved by putting a suitable su into directory /data/local/tmp and making it executable.
https://forum.xda-developers.com/attachments/su-binaries-zip.5566949/
Click to expand...
Click to collapse
The data partition is not accessible without having root first. How are they to place su in data partition to gain temp root without first gaining root to place su in data partition? How can they root the device by using a method that requires root in the first place to achieve what you are telling them?
I think the code
Code:
adb push <PATH-TO-SU-ON-PC> /data/local/tmp
always works , because this path ( /data/local/tmp ) is always present and writable on Android dev device and Emulator.
At least it always worked for me since I'm rooting Android this way.
xXx yYy said:
I think the code
Code:
adb push <PATH-TO-SU-ON-PC> /data/local/tmp
always works , because this path ( /data/local/tmp ) is always present and writable on Android dev device and Emulator.
At least it always worked for me since I'm rooting Android this way.
Click to expand...
Click to collapse
do i unroot my device by rebooting it?
p.s. will doing this solution create a possibility of bricking my device?
Technically seen you can't root / unroot a device, but only Android OS.
As with Android OS root ( sometimes called superuser ) is the same as Administrator with Windows OS. Simply adding an user with elevated privileges never will brick an Android device.
Become familiar what root is the world of Linux OS - take note that Android OS merely is a port of it.
xXx yYy said:
Technically seen you can't root / unroot a device, but only Android OS.
As with Android OS root ( sometimes called superuser ) is the same as Administrator with Windows OS. Simply adding an user with elevated privileges never will brick an Android device.
Become familiar what root is the world of Linux OS - take note that Android OS merely is a port of it.
Click to expand...
Click to collapse
so running that command will give me legit root privileges and i can do the things an admin can do without any malware or damage?
Droidriven said:
The data partition is not accessible without having root first. How are they to place su in data partition to gain temp root without first gaining root to place su in data partition? How can they root the device by using a method that requires root in the first place to achieve what you are telling them?
Click to expand...
Click to collapse
so should i really use magisk to root my device?
moutsu said:
so should i really use magisk to root my device?
Click to expand...
Click to collapse
No, try what was suggested by placing su in the data/local/tmp. If that doesn't work, try using magisk to root your device.
xXx yYy said:
I think the code
Code:
adb push <PATH-TO-SU-ON-PC> /data/local/tmp
always works , because this path ( /data/local/tmp ) is always present and writable on Android dev device and Emulator.
At least it always worked for me since I'm rooting Android this way.
Click to expand...
Click to collapse
I've never seen a device rooted by such simple means, in my experience, it has always required root to even access data partition, especially if trying to push/pull files to/from data via adb.
I mean, if it were really that easy, why would all these rooting tools snd methods that exist on XDA have ever been needed to be created?
What devices have you rooted using this method? Can you provide information that explains and confirms what you say?
Hmmmm...
Short checked on my SM-R860 Android 11...
Code:
freshbs:/ $ cd /data/local/tmp
freshbs:/data/local/tmp $ ls
freshbs:/data/local/tmp $ ls -a1l
total 6
drwxrwx--x 2 shell shell 3452 2022-03-25 01:20 .
drwxr-x--x 4 root root 3452 2022-03-25 01:20 ..
Need more time or drinks to place something here...
Waiting for other results...
Best Regards
@Droidriven
Fellow member @adfree has proven that even with Android 11 directory /data/local/tmp worlwide exists and is writeable.
Sometimes it really makes sense to understand what OP wants to achieve: He just wants to know how Android can be temporarily rooted.
xXx yYy said:
@Droidriven
Fellow member @adfree has proven that even with Android 11 directory /data/local/tmp worlwide exists and is writeable.
Sometimes it really makes sense to understand what OP wants to achieve: He just wants to know how Android can be temporarily rooted.
Click to expand...
Click to collapse
I do need to know how an android can be temporarily rooted so I can give certain apps on my phone root access to recover some stuff I accidentally deleted. However, I do need a bit of clarification on what su file I need to put into the directory as the filed you linked was a zip file.
I would also like a method on how to unroot my device.
Dear moutsu...
IMHO instead blabla... IMHO it makes sense to start from scratch with FULL infos.
I can see only bla bla Samsung Device...
Please give full details...
A
Model Name...
Example:
SM-G920F is Android 7 for instance...
B
Is Phone alive... then give full details about Firmware Version.
Easiest way for most infos...
Type:
*#1234#
Type or make Photo or Screenshot...
Best Regards
@xXx yYy
Thank you very much. But...
I clicked through your profile and find some more puzzle parts of your idea...
Learning to root my old Galaxy S4
I have an old Samsung Galaxy S4. It's been off the network for a while and its system clock has drifted. However, adb works and I can use the old phone as a sandbox environment to learn about low level Android fundamentals. I would like to learn...
forum.xda-developers.com
After this I was drunken enough to try few things with my SM-R860...
WITHOUT success...
Later I will add my ADB output... for better understanding...
IMHO I am not total Noob in Rooting something...
Also I have "some" experiences in recover halfdead devices to backup beloved data...
I am sure you have forgotten about Samsung additional Security check... like Knox crap etc...
So my conclusion...
Your method is good to know...
But chance for success in "newer" Samsung devices is not 100 %...
Maybe you can give Samsung model name... where this work?
I could check SM-G920F with Android 7 just for fun... if I have time...
Thanx in advance.
Best Regards
regardless it is writeable to adb shell only (uid 2000), chown is forbidden anyway. even if you set SUID bit that wouldn't make much sense in /data/local/tmp
furthermore, even if you could place su binary in /system (which requires unlocked bootloader + dm-verity patch) it still requires privileged daemon in background where su want connect apps (but not exist).
so this method never worked, except for some ancient android devices where remount /system was possible from adb root.
and we haven't spoke about selinux, yet
Magisk does all this, but requires* unlocked bootloader - which triggers factory reset. So unless you have some nice exploit like dirty-cow or mtk-su, temporary root is simply impossible.
edit: TWRP is not able to decrypt samsung encryption btw. So if you want have access to userdata partition on locked bootloader the only way would be (samsung signed) so called "combination ROM" (with same bootloader level) to be flashed from Odin via HOME_CSC or heimdall.
if your device is ancient old you might lucky bootloader is unlocked, userdata partition is not encrypted at all, and ROM is just signed with test keys. in that case you can flash anything on recovery partition. philz touch recovery even provided flashable zips that signed with test keys, these zips can be flashed straight from stock recovery without PC. I remember temporary zips exist, that only boot into custom recovery without actually installing it.
edit2: *except some Mediatek devices with AVBv1 where one can flash magisk patched boot.img on locked bootloader
My last 2 cents here ( I no longer participate this thread ):
The su ( read: switchuser ) command is used to run an Android system function as a different user. It is the easiest way to switch or change to the administrative account ( read: superuser ) in the current logged in session.
Most versions of Android disable the superuser ( mostly mistakenly called root user - take note that root user in Android is the user with ID 0 who is by default present on all Android versions, is the user of session when Android gets started ) account by default making the system more secure. But, this also restricts the Android user from running specific system related commands.
Using su to temporarily act as a superuser allows you to bypass this restriction and perform system related tasks with different users.
The synthax of su command is
Code:
su [options] [username [[arguments]]
If a username isn't specified, su defaults to the superuser. Now, the logged-in user can run all system commands. This will also change the home directory and path to executable files.
If the su is used to temporarily act the logged-in user as superuser then the su binary can be located anywhere in Android's filesystem, e.g. /data/local/tmp, /storage/emulated/0, etc.pp, it must not be located in Android's system partition.
xXx yYy said:
My last 2 cents here ( I no longer participate this thread ):
Click to expand...
Click to collapse
yes, that's maybe better. teach yourself about android first. android is not linux
What special privileges "/system/xbin/su" does have w.r.t. root access?
This answer says: Because of the way directory/file permissions are configured on Android, you need to have the su binary on your /system partition in order for it to work. Putting elsewhere...
android.stackexchange.com
what is your current bootloader level? combination ROM is available (haven't checked these download links)
https://www.samsungfirmwares.info/samsung-sm-j415gn-combination-firmware-file-rom
my expectation ro.debuggable=1 is enabled
adb root will work on eng build
aIecxs said:
yes, that's maybe better. teach yourself about android first. android is not linux
What special privileges "/system/xbin/su" does have w.r.t. root access?
This answer says: Because of the way directory/file permissions are configured on Android, you need to have the su binary on your /system partition in order for it to work. Putting elsewhere...
android.stackexchange.com
Click to expand...
Click to collapse
Yeah, I get where they were coming from but.....
Nah. It just doesn't work that way for everybody. Like all things android, it really just depends on what device you have and how crappy its hardware/software and security is. Lower end/cheap and old stuff doesn't have as much time invested in making them secure to save on development and distribution costs.
Unfortunately, Samsung just isn't one of those brands that are easily rooted these days, unless you buy specific models with specific firmware/binary combinations.

Categories

Resources