[ROOT][QUESTION] How can an app use root in an eng build? - Google Pixel Questions & Answers

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

Related

[Q] Terminal Emulator - Permission denied

Hello!
I don't know how to pass this problem. I have downloaded superuser app but it was futile.
TE can install aps from .apk? And other files management?
Sent from my Nexus S using XDA App
Kalimdor said:
Hello!
I don't know how to pass this problem. I have downloaded superuser app but it was futile.
TE can install aps from .apk? And other files management?
Sent from my Nexus S using XDA App
Click to expand...
Click to collapse
did you root your phone? The superuser app relies on the su binary being installed, in other words, just downloading superuser from the market doesn't root you.
Then, in the terminal emulator app, many commands require you to type "su" to enable the terminal to have root access.
To root I have used this topic :
http://forum.xda-developers.com/showthread.php?t=927838
So I can manage my phone from google SDK adb command line but from Terminal emulator I can't.
Now superuser app is asking me to : 'A zip filr (su-2.3.1-bin-signed.zip) has been placed on your sdcard, please reboot into recovery mode and flash it to update your su binary' ...
Well...the superboot method shouldn't need you to install su, it's supposed to do it for you.
The message you're getting is telling you to boot into recovery and install that zip. I don't know if it will flash from the stock recovery, but it will certainly flash from clockwork recovery if you boot into clockwork.
Key I will try from clockw. Stock found problem with certificates.

Sending back to Tmobile, Unroot Q

I have rooted my G2X and since changing roms didn't do anything to help fix the rebooting issues I've decided to send it back for a different one. I just want to make sure that I won't have a problem once they get my phone. I followed the instructions at http://forum.xda-developers.com/showthread.php?p=14159600#post14159600 but for some reason when I click unroot it seems to get stuck at a certain point.
I did make a backup of the ROM that came with the phone, but i also tried a few custom ROMs as well as trying the LG updated ROM. Currently if I open Android Terminal Emulator and type 'su' it gives me a permission denied error. If I try the 'Root Checker" app under basic it will say the phone isn't rooted and busybox isn't installed but when I go under advanced half the time I click verify it'll say it's not rooted and other times it will say it is rooted... so it's confusing me. Advanced still shows busybox as not installed, so it's just root that changes between rooted and not rooted under advanced in root checker.
Root Checker Basic > "Sorry, you don't have root access. For detailed output, please use the advanced mode" - It will say that EVERY time I try.
Root Checker Advanced >
Root Access is not properly configured or was not granted.
Superuser.apk - com.noshufou.android.su - is not installed!
The application Superuser is recommended as it provides basic security and is available for free in the android market.
Standard su binary location:
/system/bin/su: No such file or directory
Standard su binary location:
/system/xbin/su: No such file or directory
Alternate su binary location: /sbin/su: Permission denied
SU binary not found in the system declared PATH
Then if I hit Verify Root again it may show the above a few times, but eventually (sometimes 1 click after) it will show:
Congratulations! You have root access!
Superuser.apk - com.noshufou.android.su - is not installed!
The application Superuser is recommended as it provides basic security and is available for free in the Android Market
Standard su binary location:
/system/bin/su: No such file or directory
Standard su binary location:
/system/xbin/su: No such file or directory
Alternate su binary location:
/sbin/su: Permission denied
Root user id:
Root not properly returning its user id
Root group id:
Root not properly returning its group id
So I guess I'm wondering why it's showing as not rooted EVERY time under basic, but showing rooted and unrooted under advanced. If terminal emulator is giving su a permission denied error instead of a # doesn't that mean it's not rooted? Sorry for the long post, but I can't take the chance of sending the phone back rooted. Also, when I used the LG Update it updated my baseband to July 15th which isn't the one that came with the phone or the one that was with the stock rom i'm using now... could that be an issue? If anyone can help me I'd really appreciate it, thanks!
Also, since when I used the LG update it updated my baseband is it possible to revert it back to the stock baseband that was on it when I purchased the phone?
since you already did the LG update it seems like with the new baseband- why not use the stock 2.3.3 rom found here:
http://forum.xda-developers.com/showthread.php?t=1196019
i believe that after you flash this rom you will lose root- so you should be able to send back to tmobile with no prob- just make sure to flash back to stock recovery.
thanks for the reply, was actually in the process of doing that as you posted lol... thanks again, appreciate the help, at least now i know i'm going in the right direction ^_^
I installed 2.3.3, flashed back to stock recovery... terminal emulator still gives permission denied when i type 'su' and root checker still says not rooted for basic and switches between rooted and not rooted under advanced... is there a way to verify my phone isn't rooted besides root checker? I don't want to send back a rooted phone and the root checker is giving me mixed results under advanced so i don't know what to do at this point

Stock Triumph is already rooted (location of sudo)

Over at SDX, b_randon14 found sudo residing in /system/xbin/
So there's really no need for Gingerbreak, as it comes from the manufacturer with all the requirements for rooting (r/w /system and sudo), minus the terminal emulator.
Just open a terminal, issue "sudo" to gain root, then symlink or rename sudo to /system/xbin/su and /system/bin/su
Worked like a charm. To symlink, in your (downloaded) terminal type:
sudo
ln -s /system/xbin/sudo /system/xbin/su
ln -s /system/xbin/sudo /system/bin/su
Might be worth the time to mention it. Dont forget to install superuser.
Sent from my MOTWX435KT using Tapatalk
This is scary, though, since it allows apps to issue su commands without going through the superuser app.
I would still recommend installing the Superuser app, so you know when an app is requesting root access.
I think we should also test and find out whether it's safe to remove sudo. I DO think users should have a method of obtaining root access without needing to hack the firmware, but I don't like the thought that it can be done with no user notification or permission.
I guess renaming to su would be a better idea, from what I understand superuser checks for access to su but not sudo. Any idea? As explained in the original post of this finding, bad apps use their own backdoor method of obtaining root.
Sent from my MOTWX435KT using Tapatalk
Interesting
So if this could be made a script. Then we could un-root just as easily for protection. I only need it for barnacle.
root
--------
sudo
ln -s /system/xbin/sudo /system/xbin/su
ln -s /system/xbin/sudo /system/bin/su
unroot
-------
sudo
rm /system/xbin/su
rm /system/bin/su
RIGHT?
Just to clarify things.
1. Superuser does prompt when a app ask for either /system/xbin/su or /system/bin/su. The malware apps that use root exploits do not gain root access like this so superuser does nothing to stop that. You are still unprotected from root exploit apps(apps that use ratc, gingerbreak psunuter, etc.) even with superuser.
2. My root way is for people who don't want to use superuser, so you don't have to download supersuer app in order for my root method to work. That will just replace the symlinks you created with the su binary included with superuser giving you the superuser prompts everyone seems to think makes them safer.
3. As long as you know what you install on your phone, you will be good. Over at sdx, most kernels for the intercept don't use supersuer instead it just uses a su binary that doesn't have to prompt for root access. I have ran these for almost the entire life of my phone and have never had any problems.
4. Don install suspicious apps if you don't want to ruin your phone!!!
5. You can install superuser after using my root method, but I just provided this way because I don't like superuser(it's annoying and doesn't help out that much) but it seems no one feels they are safe without superuser.
6. I suspect VM added this sudo binary because in a backup script added by vm in the hidden/data/ partition uses sudo in order to backup some of the files on the phone.
7. You are just as safe using this root method as any. You just won't be notified when a app requests su through bin or xbin(but if a root exploit app is ran your screwed no matter what). As long as you know the apps on your phone are safe you are good. Just don't be dumb and download any app you come across, only used trusted apps. (i.e. root explorer, autokiller, a whole slew of any other well known apps)
I used this method to root my Triumph...my first rooted Android device! Thanks, b_randon14, for the information!
Afterwards, I installed Titanium Backup - Root and backed up my Triumph. Will Titanium Backup restore my entire device (including ROM) back to its state at the time of backup? Or does it only backup my applications and data? Before I go messing around and screw something up, I need to know that I can at least get my Triumph back to the way it was when I backed it up!
@Kool only apps and data.
Sent from my rooted Moto Triumph
Fodoom said:
@Kool only apps and data.
Sent from my rooted Moto Triumph
Click to expand...
Click to collapse
Thanks.
Is there an app that will back up the ROM and system files?
Sent from my MOTWX435KT using Tapatalk
You have to flash CWM (ClockWork Mod) and then you can back up ROMs by booting into recovery mode. After that you could install ROM manager (premium) to use a GUI (Graphical User Interface) to more easily manage your backups.
^^
Sent from my rooted Moto Triumph
Fodoom said:
You have to flash CWM (ClockWork Mod) and then you can back up ROMs by booting into recovery mode. After that you could install ROM manager (premium) to use a GUI (Graphical User Interface) to more easily manage your backups.
^^
Sent from my rooted Moto Triumph
Click to expand...
Click to collapse
OK, thanks. I see some research in my future!
Sent from my MOTWX435KT using Tapatalk

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

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 ?

is rooting this simple?

I have looked into rooting, and I don't understand how it works, but from what I can tell, shouldn't people be able to root using adb to change a file that is run regularly in /system, so that whenever it runs it would grant a given app root perms, and that app would then be able to give others root perms? would you have to change the file another way because adb doesn't run commands as root? wouldn't this be alot more simple than what has been being done?
Rooting a phone''s Android technically is simply adding standard Linux function SU ( read: Switch User ) to Android's ecosystem.
Once SU got added and you run the file without any other parameters it switches your credentials and permissions from a normal user to that of the superuser ( comparable to Administrator on Windows OS ). You are then in complete control and can add anything, remove anything and access functions on your phone that you couldn't reach before.
BTW:
With Android versions 6 and higher all what is needed is to replace the pre-installed ( restricted ) Toybox binary with an unrestricted Toybox binary ( e.g. 0.8.5 ) that contains the SU-cmdlet.
If I am understanding this, than you need to grant an app SU, but first you have to install the command that allowes giving of SU? or turn on that command (on android 6+), and grant a manager app permission to use it?

Categories

Resources