Control superuser permissions with adb - Magisk

Hello
I need to perform a broken screen recovery with adb, on a phone that is rooted and adb authenticated, but:
adb shell su .
gives me permission denied - probably because magisk manager did not grant superuser permissions to adb bridge ?
Is there any possibility to give superuser permissions by command line instead of gui?

If you haven't previously given superuser access to adb shell you're not going to be able to do it without the prompt from Magisk. I guess you could build your own Magisk Manager with the default "Automatic Response" setting set to "Grant" and install it through adb.

Thanks for the clue, I've located su_auto_reponse in Config.kt file
I am going to try it... wish me luck

Did that work out? This would be exactly what I need!

Related

tatoo M7 root completed but applications say it is not rooted

I have completed my Tattoo M7 root however applications say it is not rooted.
basically if i do ADB SHELL and then SU i get the root console but can not write to /system folder via adb push since i get permisison denied which means i always have to adb shell and su.
I believe this is somehow creating problems also to applications (i am testing Titanium Backup) which require root permissions and say i am not.
Anyone can help understanding why i can su only in console or terminal emultor but cannot use apps requiring root permissions.
Dude, you have to remount EVERY TIME /system and /data if you reboot, otherwise it says permission denied because system is read only...
Get RootExplorer, there is a little button which lets you remount partitions with one tap...
pardol said:
I have completed my Tattoo M7 root however applications say it is not rooted.
basically if i do ADB SHELL and then SU i get the root console but can not write to /system folder via adb push since i get permisison denied which means i always have to adb shell and su.
I believe this is somehow creating problems also to applications (i am testing Titanium Backup) which require root permissions and say i am not.
Anyone can help understanding why i can su only in console or terminal emultor but cannot use apps requiring root permissions.
Click to expand...
Click to collapse
hi
as ur question in the related thread
see link : http://forum.xda-developers.com/showthread.php?t=637927
CLOSED

One click root after update: "We have root, but couldn't push busybox. Not sure why!"

One click root after update: "We have root, but couldn't push busybox. Not sure why!"
I just updated .890 which seemed to go fine with no errors (unfroze all bloat, but did not unroot), but I lost root, as expected.. but when I use Pete's one-click root tool (latest version), it gets to step 3 and gives me the error about not being able to push busybox...!? It says I "have root", but none of my apps recognize it.. I've pulled the battery, rebooted and retried like 10 times... still can't get it to re-root. I've made sure Debugging and Unknown Sources is enabled and tried in Charge Mode and Mass Storage mode... Am I going to have to stock flash this thing and re-update & re-root?
I THINK I have some type of root.. maybe... because Root Explorer will let me mount the System directory as R/W and I can TRY to manipulate files, but if I delete something (like su), it appears to delete successfully, but the file comes back if I refresh the directory.. but I also noticed when I go into the System directory, Root Explorer claims I only have 1MB of free space out of 318.00MB... how did that happen? If I try to run Superuser.apk, it force closes on me.
Any help or ideas are greatly appreciated...
there's an app on the android market that will push busybox if you have root. I'd look into that
edit: have you attempted to run the one-click root again? and if that doesn't work you can try to use the adb method if you're comfortable with it. And make sure that all of your drivers and everything are up-to-date
I have done battery pulls and like a dozen+ re-tries at the 1-click root, always get the same error.. I have been into the ADB shell to try and figure this out and I see the ADB Shell starts out by giving me a # prompt... that means writable/root, right? Any instructions on what I have to do from there?
I will look into that push busybox app, thanks.
http://wiki.rootzwiki.com/index.php/Motorola_Droid_3
This is where all the info about the adb and one-click stuff. The tough part about the adb method is manually pushing su to the (i think) system/xbin folder. Then i just used the app on the marketplace to push busybox. But there's a download link for both of those on the website
Thanks for the links. I think a problem with my ADB is when I reboot it (step 3), I no longer have a # prompt.. it goes back to the $ prompt... the only way I can seem to get the # prompt in ADB is when I use Pete's temporary ADB root... but once I reboot, that goes away. When I try to do step 4, rm /data/local/12m, it says it's a directory and it's not empty and it won't remove it. :\
How do I normally make ADB give me that # prompt so I can write/edit? or am I totally off-base here?..
*edit* I am going to try and do Pete's temp ADB root again and just try steps 18+ and see if that gets me anywhere...
Kraxis said:
Thanks for the links. I think a problem with my ADB is when I reboot it (step 3), I no longer have a # prompt.. it goes back to the $ prompt... the only way I can seem to get the # prompt in ADB is when I use Pete's temporary ADB root... but once I reboot, that goes away. When I try to do step 4, rm /data/local/12m, it says it's a directory and it's not empty and it won't remove it. :\
How do I normally make ADB give me that # prompt so I can write/edit? or am I totally off-base here?..
*edit* I am going to try and do Pete's temp ADB root again and just try steps 18+ and see if that gets me anywhere...
Click to expand...
Click to collapse
After temp ADB root, steps 18 and beyond should do it. You may want to check /system/bin and /system/xbin to remove the old su binaries before pushing the new one. Some folks have one in each location for some reason. Put it in xbin, but if it doesn't work, /system/bin will. Superuser wouldn't recognize xbin for me so I moved it to /system/bin and i'm good since.
Anyone have a thought on the xbin not always working? I think this is the 3rd topic i've seen with this issue, not including myself.
Sent from my DROID3 using XDA App
OK, I got root back! I used steps 18+ for "ADB Method" (after using Pete's temp ADB root) and essentially replaced SU and Superuser.apk, CHMOD'd it rebooted and I had root! Thanks guys!!

JB OTA Forgot to Update Superuser binaries but ES File Explorer has Root

I followed the steps here
http://forum.xda-developers.com/showthread.php?p=33774480
But I forgot to update the binaries... actually I did not know I had to click where I need to click in order to update the binaries. I opened SuperUser up and it never said I needed to update binaries like Supersu does. ES File Explorer and Voodoo OTA still has root. Anyway I can fix this issue?
I tried "RestoreRoot.zip" that was posted and it says:
"Have drivers installed, phone connected, and USB Debugging enabled in Develope
r Options."
4371 KB/s (380532 bytes in 0.085s)
failed to copy 'Superuser.apk' to '/system/app//Superuser.apk': Permission denie
d
/system/bin/sh: su: can't execute: Permission denied
"Rebooting..."
uid=2000(shell) gid=2000(shell) groups=1003(graphics),1004(input),1007(log),1009
(mount),1011(adb),1015(sdcard_rw),1028(sdcard_r),3001(net_bt_admin),3002(net_bt)
,3003(inet),3006(net_bw_stats)
If the above id shows 0 then you are rooted. Press any key to exit.
I have the same problem, either upgrade to 3.1.1 binaries and only has the voodoo root and titanium, we can do?
"Have drivers installed, phone connected, and USB Debugging enabled in Develope
r Options."
failed to copy 'su' to '/system/bin//su': Permission denied
failed to copy 'Superuser.apk' to '/system/app//Superuser.apk': Permission denie
d
Unable to chmod /system/bin/su: Operation not permitted
"Rebooting..."
Click to expand...
Click to collapse
ok, well then, i dont think its going to work, but here what ive done... it might help
Restored with vodoo OTA rootkeeper, saying that root is back ! but not really lol
I've had es file explorer already rooted, so, i just copied the binary files and reboot ... nada ! was having root permission but was denied everytime automaticaly, so i reeponned the es file explorer, and cannont be granted for root acces
i oppened up the super user app, and unavailable to acces root doing the update ......
superuser status was : rwxr-xr-x : conflict (showed in red) -binary : ok (showed in green) - path : ok (showed in green aswell)....
So, that is probably why it wont allow me root acces to succesfully re-update the su binary trough the native way of the superuser.apk
so here what i've done....
Re-used vodoo to reset the root to the old binairies (wich is actually enough for adb to work as root), i've then changed superuser.apk permissions that was actually resseted to :rw-r-x-r-- .... <--- WTF ????
So changed that to : rwxr-xr-x and then, i copied the su binary to the corect place, and boom, voila, was able to set binary permission and use it as usual .....
So my guess is if you guys wont have root on an explorer, adb will have with the old binairies restored from vodoo, so you should be able to change permissions to the /system/app/superuser.apk to : rwxr-xr-x and see if something magic occured that will let you update via superuser.apk in a native way so you wont need to copy/paste the binary manually !
But what i find odd is that you have a permissions denied !
did you tried it with the OLD binairies in place from voodoo directly inside adb shell
if you just type adb shell : ittl go in $ and if u type su (hit enter) you should now see the lasp part of command line protocol changing to : #
Right ?
then you should be able to change permissions of the superuser app ? right ?
or am i completely lost in the dust !?
Edit : well, if you want to keep root on an old leaked, its your thing, but i would recomand THIS tutorial instead cause you have a real ROM through OTA now.... dont know if it will change anything, but i followed this one !
Partial Root Restore
I was able to restore root to my phone after the 4.1.1 update using the information in this thread...
http://forum.xda-developers.com/showthread.php?t=1911261
Basically, if you had a root backup before the update, you may still have partial root on your phone.
To verify...
adb shell
su
If you find yourself at the # prompt, not all hope is lost!
:fingers-crossed:
Regained root on my Atrix using this instructions
http://forum.xda-developers.com/showthread.php?p=35905543#post35905543

adb.exe shell>su>denied???

I have a problem..... If the title didnt say it, then ill describe my situation
When i open command windows from platform-tools folder in the SDK folder, i type in adb.exe shell. it says daemon started successfully then the line: [email protected]:/$ comes up and i type in: su. but permission denied??????????? I have superuser flashed on my phone and i have root level access on my phone though. Am i doing something wrong????
072665995 said:
I have a problem..... If the title didnt say it, then ill describe my situation
When i open command windows from platform-tools folder in the SDK folder, i type in adb.exe shell. it says daemon started successfully then the line: [email protected]:/$ comes up and i type in: su. but permission denied??????????? I have superuser flashed on my phone and i have root level access on my phone though. Am i doing something wrong????
Click to expand...
Click to collapse
If you're using CM ROM, then you also have to enable ADB root access under Developer options. The default settings is root access for apps only.
itandy said:
If you're using CM ROM, then you also have to enable ADB root access under Developer options. The default settings is root access for apps only.
Click to expand...
Click to collapse
o wow thanks man +thanks

Freedom OS - "adb root" returns "cannot run as root in production build"

Freedom OS - "adb root" returns "cannot run as root in production build"
Hi! How can I run ADB as root? I'm on FreedomOS. I've tried flashing ElementalX Kernel, but it didn't fix this.
Apparently I need ro.secure = 0 and ro.debuggable = 1. How can I set this? Could someone upload a modified boot.img with those set?
Or, the main problem, could someone run the pull_library.sh script on their 3T that can be downloaded from here: https://github.com/OnePlusOSS/android/blob/oneplus3/6.0.1/pull_library.sh
It won't pull some of the files.
Thanks!
Is "adb root" different from typing:
adb shell
su
You also need to have adb root access enabled in Magisk Manager or SuperSU app.
redpoint73 said:
Is "adb root" different from typing:
adb shell
su
You also need to have adb root access enabled in Magisk Manager or SuperSU app.
Click to expand...
Click to collapse
That's the thing, I can do adb shell and su properly, I get a su prompt and I'm good. But even with that I can't pull certain system files, remount system rw, or edit certain system files.
I need ADB to run as root for that, and there is a difference. ADB shell and su just allows me to run device commands and stuff as root (like terminal app on Android) but ADB root lets me use ADB commands as root like what I mentioned above.
There's apparently two solutions. One, a modified adbd binary that doesn't check for ro.debuggable (which I can't find) or have a kernel that sets ro.debuggable to 1 in default.prop. Or I need a userdebug or engineering build of Freedom OS based off of OxygenOS.
I can't find any of those, and my decompiled stock kernels don't boot the phone properly.
Or, I could get around all this if someone would be able to upload the files I don't have from their device.
Also, where do I set ADB root access in Magisk?
Sorry for the wall of text haha,.just lots going on
NateDev said:
Also, where do I set ADB root access in Magisk?
Click to expand...
Click to collapse
In Magisk Manager, open the 3-line menu icon (top left corner), go to Settings, and you will see under the Superuser heading, the toggle for "Superuser Access" (Apps only, Apps and ADB, etc.).
NateDev said:
Sorry for the wall of text haha,.just lots going on
Click to expand...
Click to collapse
No apology needed. Thanks for the clarification. I don't use adb often. On this device, not even once, I don't think.
redpoint73 said:
In Magisk Manager, open the 3-line menu icon (top left corner), go to Settings, and you will see under the Superuser heading, the toggle for "Superuser Access" (Apps only, Apps and ADB, etc.).
No apology needed. Thanks for the clarification. I don't use adb often. On this device, not even once, I don't think.
Click to expand...
Click to collapse
Ok, thanks, I'll try that when I get home and see if it works
NateDev said:
Hi! How can I run ADB as root? I'm on FreedomOS. I've tried flashing ElementalX Kernel, but it didn't fix this.
Apparently I need ro.secure = 0 and ro.debuggable = 1. How can I set this? Could someone upload a modified boot.img with those set?
Or, the main problem, could someone run the pull_library.sh script on their 3T that can be downloaded from here: https://github.com/OnePlusOSS/android/blob/oneplus3/6.0.1/pull_library.sh
It won't pull some of the files.
Thanks!
Click to expand...
Click to collapse
If all you need to do is set ro.debuggable and ro.secure you might be able to use Magisk's resetprop tool to set them on the fly.
Code:
resetprop ro.debuggable 1
resetprop ro.secure 0
Didgeridoohan said:
If all you need to do is set ro.debuggable and ro.secure you might be able to use Magisk's resetprop tool to set them on the fly.
Code:
resetprop ro.debuggable 1
resetprop ro.secure 0
Click to expand...
Click to collapse
Thanks, so I opened up ADB, and ran
Code:
adb shell resetprop ro.debuggable 1
but it tells me "resetprop: Initialize error". I've just assumed tho that resetprop is included when you install Magisk. If it's not, how can I install it? I also tried running "resetprop" in Termux on my phone, but it says resetprop can't be found.
Thanks
NateDev said:
Thanks, so I opened up ADB, and ran
Code:
adb shell resetprop ro.debuggable 1
but it tells me "resetprop: Initialize error". I've just assumed tho that resetprop is included when you install Magisk. If it's not, how can I install it?
Thanks
Click to expand...
Click to collapse
It needs su...
Didgeridoohan said:
If all you need to do is set ro.debuggable and ro.secure you might be able to use Magisk's resetprop tool to set them on the fly.
Code:
resetprop ro.debuggable 1
resetprop ro.secure 0
Click to expand...
Click to collapse
Didgeridoohan said:
It needs su...
Click to expand...
Click to collapse
Sorry, forgot to mention, I tried it with su in adb shell as well, changed to #, but still gives same error...
Nevermind, a reboot of the phone fixed it. Unfortunatly I still get cannot run in production builds, even when the 2 items are set to the proper values. This guide: https://forum.xda-developers.com/showthread.php?t=1794203 says it should work with those 2 set, but for some reason it doesn't. Time to find a new solution...
NateDev said:
Sorry, forgot to mention, I tried it with su in adb shell as well, changed to #, but still gives same error...
Click to expand...
Click to collapse
Hm... Works fine running it in a terminal emulator (I just tested).

Categories

Resources