Changing file permissions using chmod command
suggest changeTo change file permissions this way, the device must be rooted. The su binary is not on factory images.
Convention:
adb shell su -c "chmod <numeric-permission> <file>"
The numeric mode is built from the user, group, and world digits.
For example, to make a file readable, writable, and executable by everyone:
adb shell su -c "chmod 777 <file-path>"
Or
adb shell su -c "chmod 000 <file-path>"
if you intend to deny every permission.
1st digit-specifies user permission, 2nd digit- specifies group permission, 3rd digit - specifies world (others) permission.
Access permissions:
--- : binary value: 000, octal value: 0 (none)
--x : binary value: 001, octal value: 1 (execute)
-w- : binary value: 010, octal value: 2 (write)
-wx : binary value: 011, octal value: 3 (write, execute)
r-- : binary value: 100, octal value: 4 (read)
r-x : binary value: 101, octal value: 5 (read, execute)
rw- : binary value: 110, octal value: 6 (read, write)
rwx : binary value: 111, octal value: 7 (read, write, execute)
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents