android Am.jar add permissions on rooted device - android

I have a rooted device, and I noticed that the am command in adb cannot perform all its tasks since it does NOT have "signature" permission.
How do you suppose that happens?......... I noticed this behavior on other devices as well (rooted and non rooted)
On an emulator Am.jar seems to have this permission.
Is there any way I can modify the Am.jar (or the app_process that runs it) so that it would have the same signature as the systems'.
As I mentioned, my device is also rooted.
Thanks

Turns out, as #Chris mentioned, that the problem isn't signing permissions.
When running Am on the emulator it runs as a system process. On devices it doesn't.
If I run this command as root then all permissions are granted (even signature).

Related

Accessing Android Root Privileges Without Having To Root The Phone

I'm trying to access the root privileges of my android phone (OS 6.0.1 Samsung) without rooting the phone. It can be an app/service anything as long as I can get root access without having to root the phone.
I found out that there are some code/command you can do using 'su' but it requires a rooted phone. Can you use 'su' command in an unrooted android phones to access root privileges? If so, how? Or is there a way you can use root access without rooting the phone- by any means? Command lines? Third-party tools?
Thanks in advance.
I'm trying to access the root privileges of my android phone (OS 6.0.1 Samsung) without rooting the phone.
By definition, that is not possible. That is akin to demanding that something be purple without being purple.
Can you use 'su' command in an unrooted android phones to access root privileges?
No. For starters, it will not exist.
Or is there a way you can use root access without rooting the phone- by any means? Command lines? Third-party tools?
No.
SU is basically a binary that plays an important role in Android rooting and it is normally placed in the /system partition. It will be used when other apps need superuser permission, so if you don't have it there is no way to do this.
Check this link for further information https://www.kingoapp.com/troubleshoot/su-warning-window-on-kingo-superuser.htm
It is not possible to get root acces without su binary files in xbin or bin folder...and sudo was previously used in lower android version long ago this command can give you root acces without root but now not exist in any newer version...
Try to google your problem i am sure if u have samsung phone there must a procedure for root... happy rooting goodluck

Rooted but su says "Permission denied"

I have this "old" Lenovo A2107 tablet which I rooted years ago (using a download from http://androidforums.com/threads/a2107-root-mods-and-rom-discussion.661261/, tho running its root.bat script by hand from my GNU/Linux machine) and that worked fine.
Then I passed this tablet to my daughter for a couple years, and now I got it back.
/system/bin/su is still present, still the same date and size, still mode "rwsr-sr-x", still the same firmware (Android 4.0.3) so all looks fine, but when I try to run it from a shell, it just tells me "Permission denied".
Any idea what might be going on? What I could try to do to track it down?
Nowadays Magisk is commonly used for rooting.
I've found that on my Oneplus 5 (Oxygen OS, Nougat) it was sufficient to go to Magisk Manager app, open superuser permissions screen and toggle Shell (com.android.shell) to resolve the adb su permission denied problem.
OK, for those curious to know, I figured out what it was: the /system/bin/su program either accepts the request as-is (depending on who asks) or passes the request to some other program (Superuser.apk).
As it turns out, I still have /system/bin/su but Superuser.apk was missing. Luckily, /system/bin/su worked fine from the "adb shell", even though it said "Permission denied" when used from ConnectBot and other terminal emulators. So I used "adb shell" to get root access and manually copied Superuser.apk into /system/apps.
FWIW... I had a similar problem ( running 'su' from ADB shell yielded 'permission denied' ), so I'll describe my solution.
For context, I had rebrained my Galaxy Nexus with CyanogenMod.
So, I looked at the system settings, and it contains a 'Superuser' section; in that section's own settings ( small menu ), there is a 'Superuser Access' option, which was set to 'Apps only'. I changed that to 'Apps and ADB', and then I was able to start an ADB shell, and from that shell, I was now allowed to run 'su'. :-)

Android: adbd cannot run as root in production builds

I have an Android-based phone (2.3.6) with unlocked root privileges.
Since i'd like to have access to my phone through my computer, today i've installed QtAdb and Android SDK.
If i open a command prompt and i do
adb shell su
i get
#
And so I am able to copy, remove, push files on my phone (on the phone i get a notification using the app "SuperSU".)
But if i launch QtAdb - under Windows 7 - i get the following error: "adbd cannot run as root in production builds". I miss something? There's something wrong with QtAdb?
The problem is that, even though your phone is rooted, the 'adbd' server on the phone does not use root permissions. You can try to bypass these checks or install a different adbd on your phone or install a custom kernel/distribution that includes a patched adbd.
Or, a much easier solution is to use 'adbd insecure' from chainfire which will patch your adbd on the fly. It's not permanent, so you have to run it before starting up the adb server (or else set it to run every boot). You can get the app from the google play store for a couple bucks:
https://play.google.com/store/apps/details?id=eu.chainfire.adbd&hl=en
Or you can get it for free, the author has posted a free version on xda-developers:
http://forum.xda-developers.com/showthread.php?t=1687590
Install it to your device (copy it to the device and open the apk file with a file manager), run adb insecure on the device, and finally kill the adb server on your computer:
% adb kill-server
And then restart the server and it should already be root.
For those who rooted the Android device with Magisk, you can install adb_root from https://github.com/evdenis/adb_root. Then adb root can run smoothly.
Use adb shell; su;
I still have not found any other solution for android 12 rooted with magisk. adb_root does not work with android 12. adbd insecure does not work for me and throws error could not patch adbd.
if anyone is still having issues, heres how i fixed it
you have to start the shell with the phone and go into the magisk app and in the superuser tab (bottom) you have to enable root access for the shell and it works!
You have to grant the Superuser right to the shell app (com.anroid.shell).
In my case, I use Magisk to root my phone Nexsus 6P (Oreo 8.1). So I can grant Superuser right in the Magisk Manager app, whih is in the left upper option menu.

WRITE_SECURE_SETTINGS permission error even when added in Manifest

I have added "android.permission.WRITE_SECURE_SETTINGS" in the Manifest. But still i get an error message saying - required "WRITE_SECURE_SETTINGS".
I have seen a lot of talks about this, and that this setting is prevented for third party software.
It is any other way that i can add my application can gain this permission?
I have see this adb command, but i not so familiar how to use this to add my application to my device, is below command is require root my device before it can be use because it failed to copy by Read-only file system?
adb remount
adb push app.apk /system/app/
I would like to add that WRITE_SECURE_SETTINGS permission can be granted over adb and this approach does NOT require root. Here is a command:
adb shell pm grant your.package.name android.permission.WRITE_SECURE_SETTINGS
Firstly, as you have read before, WRITE_SECURE_SETTINGS is NOT available to applications! So you cannot use this permission regardless whether you are on rooted or production builds.
So, if you wish to enable this setting, create your own firmware that does what you need and load that firmware on whatever devices you wish. Or, contribute your changes to existing firmware mods (e.g., Cyanogen).
Some other applications use techniques like Reflection using Java to gain access to functions not exposed via API, you can probably try the same.
Secondly, adb remount does not work as is with production builds unless the phone is rooted or firmware enables it by default.
I recently struggled with this very thing. My client wanted an app that would turn NFC off when the device was charging (wireless charger) and then on when it was removed from the charger. I was running KitKat on my Nexus 7, and even though I had WRITE_SECURE_SETTINGS in the Manifest, and the app in /system/app/, it would not work.
Turns out, that in 4.4 they added additional security. In 4.3 however, it works if three things are true:
Manifest has WRITE_SECURE_SETTINGS
App is in /system/app/
The package is signed by a key (any key)
I rooted the device using the awesome Nexus Root Toolkit (NRT) from http://www.wugfresh.com/nrt/ then installed BusyBox and system app mover from:
https://play.google.com/store/apps/details?id=stericson.busybox
https://play.google.com/store/apps/details?id=de.j4velin.systemappmover
I installed my custom signed APK and moved it into place using system app mover, which then restarted the device. It worked perfectly. Hope this helps.
For the api that I used, which required WRITE_SECURE_SETTINGS privileges, I had to include this in the manifest:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
...
coreApp="true"
android:sharedUserId="android.uid.system">
<uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS"/>
...
ref: https://github.com/android/platform_packages_apps_settings/blob/master/AndroidManifest.xml
I also had to run the application as a system app (under: /system/app).
Here is an how to: http://www.addictivetips.com/mobile/how-to-install-any-app-as-system-app-on-android/
I met this situation too,and then i follow the rules below:
1.add WRITE_SECURE_SETTINGS in manifest
2.make my own firmware
3.add LOCAL_CERTIRICATE := platform
Try this,
adb shell pm grant your.package.name android.permission.WRITE_SECURE_SETTINGS
I was able to fix this problem by enabling notification access.
go to settings
click on sound and notification
scroll down
click on notification access

Why doesn't program in /system/app get SuperUser access?

We are creating an Android application which requires super user privileges. The SuperUser.apk and su are installed. However there seems to be a difference between installing our application in /data/app vs. /system/app. If we install in /data/app, everything seems to work fine. If we install in /system/app, SuperUser.apk does not popup to grant privileges.
Are there certain types of programs that must be installed in one location vs. another?
TIA
APK files in the /system/app folder already have system-level permissions so they don't require SuperUser, which I assume is why it doesn't pop up.
You should confirm that your application already has the permission you have requested. For instance, AlarmManager.setTime requires the signatureOrSystem permission android.permission.SET_TIME and will throw an exception if it doesn't have it. You can also check explicitly with PackageManager.checkPermission.
If this doesn't work, check the attributes of the APK file. If they don't match the other APKs in the system folder Android may ignore them. You can fix it like this:
chmod 644 <filename>

Categories

Resources