Android: adb: Permission Denied
Solution 1
According to adb help
:
adb root - restarts the adbd daemon with root permissions
Which indeed resolved the issue for me.
Solution 2
Without rooting: If you can't root your phone, use the run-as <package>
command to be able to access data of your application.
Example:
$ adb exec-out run-as com.yourcompany.app ls -R /data/data/com.yourcompany.app/
exec-out
executes the command without starting a shell and mangling the output.
Solution 3
The reason for "permission denied" is because your Android machine has not been correctly rooted. Did you see $
after you started adb shell
? If you correctly rooted your machine, you would have seen #
instead.
If you see the $
, try entering Super User mode by typing su
. If Root is enabled, you will see the #
- without asking for password.
Solution 4
You might need to activate adb root from the developer settings menu.
If you run adb root
from the cmd line you can get:
root access is disabled by system setting - enable in settings -> development options
Once you activate the root option (ADB only or Apps and ADB) adb will restart and you will be able to use root from the cmd line.
Solution 5
None of the previous solutions worked for me but I was able to make it work using this command
adb shell "run-as com.yourcompany.app cat /data/data/com.yourcompany.app/shared_prefs/SHARED_PREF_PROTECTED.xml" > SHARED_PREF_PROTECTED.xml
Related videos on Youtube

Caner
"My country is the world...and my religion is to do good." - Thomas Paine
Updated on April 22, 2021Comments
-
Caner over 1 year
Whatever I type after
adb shell
it fails withPermission denied
:D:\android-sdk-windows\platform-tools>adb shell find /data -name *.db find: permission denied D:\android-sdk-windows\platform-tools>adb shell test test: permission denied D:\android-sdk-windows\platform-tools>adb remount remount failed: No such file or directory
Any ideas?
-
Vamsi over 11 yearsWhere are you trying to run the adb shell, in emulator or target device; if on target device you cant access the /data folder until unless you have root permission.
-
d.popov about 10 yearsafter
adb root
>>adbd cannot run as root in production builds
what to do? -
Caner about 10 yearsI guess you need a rooted phone to be able to run that
-
d.popov almost 10 yearsyes, I know. But, as you see currently I do not have the reputation to comment the Author's post, but i had this problem, so the only way was to add new post, or to open duplicate thread, so I decided to add a post.
-
d.popov almost 10 yearsthe phone is was rooted, but something went wrong with the OS. It was freezing after loading the home screen on reboot. Anyway - nandroid flashing the phone with the stock ROM solved the problem.
-
-
Caner over 11 years
adb remount
gives:remount failed: No such file or directory
-
Paul Whittaker about 9 yearsYou'll also need to enable root access for adb if you haven't done so already -- see @Macarse's answer.
-
Paul Whittaker about 9 yearsIf you can't see the 'Developer options' item in your Settings menu, see this answer for details of how to make it visible. (In short: Settings > About phone > Build number > Tap 7 times(!).)
-
Paul Whittaker about 9 yearsOnce you have correctly rooted your machine, you will need to have enabled adb root access and be running adb in root mode before your
su
step can work - see @Macarse's and @Roman's answers. -
JohnyTex about 8 yearsBut once in, I don't see anything here! What should it say?
-
Chris Stratton about 8 yearsThis option does not exist in stock Android builds - if it exists at all, it would be confined to someone's aftermarket ROM.
-
Chris Stratton about 8 yearsNo. This has nothing to do with the problem.
-
Chris Stratton about 8 yearsNo. The reason for "permission denied" is that there is no
find
command. -
Fabian Zeindl over 6 yearsThis is not true. You just have to switch to the correct user. See my answer below: stackoverflow.com/a/38292436/342947
-
Jeroen over 5 yearsIs there a way to do this without a GUI? I would guess there is an option for it in
/system/build.prop
, but I can't find it. -
Divyanshu Kushwaha about 5 years@ChrisStratton You saved my life, I was also writting shell command from inside the adb shell already
-
Chris Stratton about 5 yearsThis only works for apps built to be debuggable - ie, you can use it for apps you are developing but it should not work for production releases of your app, or anyone else's apps.
-
Chris Stratton about 5 yearsNo. The question concerns a refusal from Android, not from Windows.
-
martinkunev about 5 yearsWhere do I find the menu to look for settings?
-
Tom M almost 4 yearsThis returns
run-as: Could not set capabilities: Operation not permitted
for me -
Pete Alvin about 3 yearsI'm trying to see files in the Android simulator. I type 'su' after the '$' and it says: su: not found
-
ultraon over 2 yearsIt works for emulator API 29, and don't forget to put
.debug
prefix to the end of app's package for debug apps: -
Andrew Koster over 1 yearNothing in the question mentions a rooted device. Why does this answer require the device to be rooted?
-
raw 7 monthsThis is great, however for binary files such as images or localDBs, the encoding seems to change. How would one copy binary files to windows?