Android:adb:权限被拒绝

发布于 2024-12-04 10:18:24 字数 398 浏览 2 评论 0原文

无论我在 adb shell 之后输入什么,它都会失败并显示 Permission returned

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

有什么想法吗?

Whatever I type after adb shell it fails with Permission 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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(10

乖乖兔^ω^ 2024-12-11 10:18:24

根据adb help

adb root                     - restarts the adbd daemon with root permissions

这确实为我解决了这个问题。

According to adb help:

adb root                     - restarts the adbd daemon with root permissions

Which indeed resolved the issue for me.

朮生 2024-12-11 10:18:24

无需root:如果您无法root手机,请使用run-as命令来访问应用程序的数据。

例子:

$ adb exec-out run-as com.yourcompany.app ls -R /data/data/com.yourcompany.app/

exec-out 执行命令而不启动shell 并修改输出。

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.

后eg是否自 2024-12-11 10:18:24

“权限被拒绝”的原因是因为您的Android机器尚未正确root。启动 adb shell 后,您看到 $ 了吗?如果您正确地获得了计算机的 root 权限,您将会看到 #

如果您看到 $,请尝试输入 su 进入超级用户模式。如果启用 Root,您将看到 # - 无需输入密码。

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.

瑕疵 2024-12-11 10:18:24

以前的解决方案都不适合我,但我能够使用此命令使其工作

adb shell "run-as com.yourcompany.app cat /data/data/com.yourcompany.app/shared_prefs/SHARED_PREF_PROTECTED.xml" > SHARED_PREF_PROTECTED.xml

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
幸福丶如此 2024-12-11 10:18:24

您可能需要从开发人员设置菜单激活 adb root。
如果您从 cmd 行运行 adb root,您可以得到:

root access is disabled by system setting - enable in settings -> development options

一旦激活 root 选项(仅限 ADB 或应用程序和 ADB),adb 将重新启动,您将能够从 cmd 行使用 root。

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.

○闲身 2024-12-11 10:18:24

非root用户无法访问data分区,如果您想访问它,您必须root您的手机。

ADB root 并不适用于所有产品,并且取决于手机构建类型。

在新版本的android studio中,您可以探索可调试应用程序的/data/data路径。

更新 2022

Android Studio 新版本提供了一些工具,例如 Device ExplorerApp Inspection 来访问应用程序数据。 (应用程序必须可调试)。

The data partition is not accessible for non-root users, if you want to access it you must root your phone.

ADB root does not work for all product and depend on phone build type.

in the new version of android studio, you can explore /data/data path for debuggable apps.

update 2022

Android Studio new versions have some tools like Device Explorer and App Inspection to access application data. (app must be debuggable).

如梦亦如幻 2024-12-11 10:18:24

如果您想像我一样获取 /data/anr/ ,您可以使用一个简单的方法

adb bugreport

源:这个答案

if you are looking to get /data/anr/ as I was, you can use an easy approach

adb bugreport

source: this answer

云淡风轻 2024-12-11 10:18:24

执行 adb 重新挂载。然后尝试 adb shell

Do adb remount. And then try adb shell

七颜 2024-12-11 10:18:24

我的解决方案是(感谢 David Ljung Madison 帖子)

  1. Root 手机 &确保它是 root 的
  2. Adb 服务器 (adbd) 未以 root 身份运行,因此 下载并;安装了 adbd 不安全应用程序
  3. 重新启动 adb adb Kill-server
  4. 运行它并;像花一样工作!

Solution for me was (thx to David Ljung Madison post)

  1. Root the phone & be sure it is rooted
  2. Adb server (adbd) was not run as root so downloaded & installed the adbd insecure app
  3. Restart adb adb kill-server
  4. Run it & worked like a flower!
兔小萌 2024-12-11 10:18:24

以管理员身份运行您的 cmd 这将解决我的问题。
谢谢。

Run your cmd as administrator this will solve my issues.
Thanks.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文