如何执行 adb shell 命令,包括从带有 os.system 的 Python 脚本授予对 /data/data 目录中的子文件夹的权限?

问题描述 投票:0回答:0

我正在尝试使用 os.system 在一行中执行以下一系列 adb 命令:


OnePlus5:/ $ su

OnePlus5:/ # cd data/data && chmod -R 777 ./

chmod: chmod 'lib' to 120777: Read-only file system
chmod: chmod 'lib' to 120777: Read-only file system
chmod: chmod 'lib' to 120777: No such file or directory
chmod: chmod 'lib' to 120777: Read-only file system
chmod: chmod 'lib' to 120777: Read-only file system
chmod: chmod 'lib' to 120777: Read-only file system
chmod: chmod 'lib' to 120777: Read-only file system
chmod: chmod 'lib' to 120777: Read-only file system


1|OnePlus5:/data/data # exit


1|OnePlus5:/ $ exit

这是我的 Python 脚本中应该执行此操作的行:

os.system("adb shell su -c 'cd /data/data && chmod -R 777 ./; exit' && exit")

这是控制台中与此行相关的两行:

su: exec failed for cd Error:No such file or directory
adb: error: failed to copy '/data/data/xxxxxx' to './xxxxx': remote open failed: Permission denied

然后我需要在数据/数据文件夹中的文件夹中提取一个特定文件,该文件夹具有之前使用

adb pull
给出的新权限,但我不能像上面看到的那样做。

帮助将不胜感激!

python adb chmod os.system su
© www.soinside.com 2019 - 2024. All rights reserved.