Adam
Adam

Reputation: 1

How to execute adb shell commands that includes granting permissions to subfolders in /data/data directory from a Python script with os.system?

I'm trying to execute the following series of adb commands in one line using os.system:


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

Here's the line from my Python script that supposed to do it: os.system("adb shell su -c 'cd /data/data && chmod -R 777 ./; exit' && exit")

here are the two lines from the console that are related to this line:

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

I then need to pull a spcific file in a folder that is in the data/data folder with the new permissions given earlier using adb pull but I can not do it as you can see above.

My device is rooted

Help would be much appreciated!

Upvotes: 0

Views: 232

Answers (0)

Related Questions