Android adb shell Changing file permissions using chmod command

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

Example

Notice, that in order to change file prmissions, your device need to be rooted, su binary doesn't come with factory shipped devices!

Convention:

adb shell su -c "chmod <numeric-permisson> <file>"

Numeric permission constructed from user, group and world sections.

For example, if you want to change file to be readable, writable and executable by everyone, this will be your command:

adb shell su -c "chmod 777 <file-path>"

Or

adb shell su -c "chmod 000 <file-path>"

if you intent to deny any permissions to it.

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)


Got any Android Question?