# [SCRIPT] Permissions init.d Script



## roman (Jun 11, 2011)

Hey guys,

I had a nasty issue with Bi-Winning a couple weeks ago where I pushed custom framework and totally forgot about permissions. Apparently when you don't set the proper permissions it can really slow things down.

So I figured this could easily be avoided. So because of that and our CWM "Fix Permissions" option doesn't really do anything, I wrote this script to fix it!

Upon every boot, it will scan /system/app, /system/framework/, and /data/app and set the proper permissions for all the files in there.

Here's the init.d script, it's really simple, but also effective










```
#!/system/bin/sh<br />
# Permission script<br />
# Written by Einherjar Dev Team<br />
# www.edtdev.com<br />
<br />
logFile=/data/logs/perms.log<br />
if [ -f $logFile ]; then<br />
        rm $logFile<br />
fi<br />
touch $logFile<br />
<br />
mount -o rw,remount /dev/block/stl9 /system<br />
echo "Setting permissions" >> $logFile<br />
        for file in /system/app/* /system/framework/* /data/app/*; do<br />
                echo "    setting permissions (644) for $file" >> $logFile<br />
                chmod 644 $file<br />
        done<br />
        <br />
        echo "chmodding init.d folder"<br />
        chmod 777 /system/etc/init.d<br />
        <br />
        for file in /system/etc/init.d/*; do<br />
                echo "    setting permissions (777) for $file" >> $logFile<br />
                chmod 777 $file<br />
        done<br />
echo "Permissions set" >> $logFile
```
as you can imagine, you can modify this to your needs


----------



## Jonathon (Jun 22, 2011)

Did it make a noticeable improvement? I'm wondering if maybe I've missed out some permissions by accident.
thanks for sharing!

Sent from my Nexus S


----------

