1

I have changed the permissions of the file \system\bin\chmod from 777(-rwxrwxrwx) to 644 (-rw-r--r--), how can I turn back to 777?

I don't know is this may be relevant, but I'm using a samsung J5 running android 9.

Thank you in advance.

1
  • There are multiple options. See my comment to the answer. Don't set it to 777. It's too open. 755 is enough for executable files. Commented Apr 16, 2020 at 14:42

1 Answer 1

0

I wonder how you can change /system without read-write access. Usually a reboot will restore permissions, but you can also change it on-the-fly

chmod is most likely a symlink to toybox and you have changed permissions of toybox instead. this will affect most (if not all) of the commands. you can maybe fix this with busybox

external MicroSD Card permissions are -rwxrwx--x per default, so maybe this trick works (untested). copy binary to external MicroSD Card first, then move the file into /data/local/tmp (moving a file does keep permissions)

adb push busybox-armv7l /sdcard/busybox
adb shell
su
ls -1 /storage
cp /sdcard/busybox /storage/????-????
cd /data/local/tmp
mv /storage/????-????/busybox .
./busybox mount -o remount,rw /
./busybox chmod a+x /system/bin/toybox

if you really just changed permissions of chmod (which must a binary in this case) you can just use toybox applets with prefix toybox chmod


in case ls mount cp and mv not working, run the following commands in termux (thx @ Irfan Latif)

pkg install busybox
su
export PATH=/data/data/com.termux/files/usr/bin:$PATH
busybox mount -o remount,rw /
busybox chmod a+x /system/bin/toybox
2
  • 1
    x permission on emulated storage is only for directories (for traversal) not for files (for execution). On Android 8+ usually vendor partition has its own toybox binary. Using Termux would be another straightforward option. Installing busybox apps from PlayStore is another option. And if tar isn't a toybox applet on device, busybox binary can also be extracted from a tar archive which would preserve permissions. Commented Apr 16, 2020 at 14:35
  • External SD cards are also exposed to apps as emulated storage. You may please edit your answer to include the details. Commented Apr 16, 2020 at 16:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .