[Galaxy Note 3 Android Development] zroice:
Do I need to explain what a permission fixer script is supposed to do?

It fixes all the permissions (currently only for /system) and removes some knox bloatware folders along the way.

Root and busybox is required.

---

NOTE: This is the first step for a "rom installer script".

Please let me know if you find any errors or want any folders added to the additional permission fixes.

Or if you know any enhancements too off course.

There might be some redundancy within the script, but I wanted to better be safe

---.

So here it goes (download attached below):

Copy it to wherever you like and make it runnable (chmod 755) to execute.

I just copied it to my /system/xbin folder so I just have to type "fix_permissions.sh" when I want to fix em.

(could even get rid of the ".sh" to get the fix_permission command back kind of)

#!/system/bin/sh

echo
echo zro\'s ultimate permission fixer script v1.0
echo ============================================
echo
echo Step 1: Mounting /system writable
echo ---------------------------------
mount -o rw,remount /system

# >>> STOCK PERMISSIONS >>>
echo
echo Step 2: Fixing stock permissions
echo --------------------------------

# /system
echo fixing permissions for /system
busybox chown 0.0 /system
busybox chown 0.0 /system/*
busybox chown 0.2000 /system/bin
busybox chown 0.2000 /system/vendor
busybox chown 0.2000 /system/xbin
busybox chmod 755 /system/*
find /system -type f -maxdepth 1 -exec busybox chmod 644 {} \;

# /system/app
echo fixing permissions for /system/app
busybox chown 0.0 /system/app/*
busybox chmod 644 /system/app/*

# /system/cameradata
echo fixing permissions for /system/cameradata
busybox chown -R 0.0 /system/cameradata
find /system/cameradata \( -type d -exec busybox chmod 755 {} + \) -o \( -type f -exec busybox chmod 644 {} + \)

# /system/bin
echo fixing permissions for /system/bin
busybox chmod 755 /system/bin/*
busybox chown 0.2000 /system/bin/*
busybox chown -h 0.2000 /system/bin/*
busybox chown 0.0 /system/bin/log /system/bin/ping /system/bin/sysinit
busybox chmod 777 /system/bin/log
busybox chown 0.3003 /system/bin/netcfg
busybox chmod 2750 /system/bin/netcfg
busybox chmod 750 /system/bin/run-as
busybox chown 0.0 /system/bin/su
busybox chmod 6755 /system/bin/su
busybox chown 0.0 /system/bin/daemonsu
busybox chmod 6755 /system/bin/daemonsu

# /system/containers - Knox Bloatware (will be removed)
echo fixing permissions for /system/containers - Knox Bloatware - will be removed
rm -r /system/containers

# /system/csc
echo fixing permissions for /system/csc
busybox chown -R 0.0 /system/csc
find /system/csc \( -type d -exec busybox chmod 755 {} + \) -o \( -type f -exec busybox chmod 644 {} + \)

# /system/etc
echo fixing permissions for /system/etc
busybox chown -R 0.0 /system/etc
find /system/etc \( -type d -exec busybox chmod 755 {} + \) -o \( -type f -exec busybox chmod 644 {} + \)
busybox chown 0.2000 /system/etc/init.goldfish.sh
busybox chmod 550 /system/etc/init.goldfish.sh
busybox chmod 664 /system/etc/boot_fixup
busybox chown 1014.2000 /system/etc/dhcpcd/dhcpcd-run-hooks
busybox chmod 550 /system/etc/dhcpcd/dhcpcd-run-hooks
busybox chmod 755 /system/etc/init.d/*
busybox chmod 6755 /system/etc/install-recovery.sh

# /system/finder_cp
echo fixing permissions for /system/finder_cp
busybox chown 0.0 /system/finder_cp/*
busybox chmod 644 /system/finder_cp/*

# /system/fonts
echo fixing permissions for /system/fonts
busybox chown 0.0 /system/fonts/*
busybox chmod 644 /system/fonts/*

# /system/framework
echo fixing permissions for /system/framework
busybox chown 0.0 /system/framework/*
busybox chmod 644 /system/framework/*

# /system/lib
echo fixing permissions for /system/lib
busybox chown -R 0:0 /system/lib
find /system/lib \( -type d -exec busybox chmod 755 {} + \) -o \( -type f -exec busybox chmod 644 {} + \)

# /system/media
echo fixing permissions for /system/media
busybox chown -R 0:0 /system/media
find /system/media \( -type d -exec busybox chmod 755 {} + \) -o \( -type f -exec busybox chmod 644 {} + \)

# /system/preloadedkiosk - Bloatware (will be removed)
echo fixing permissions for /system/preloadedkiosk - Bloatware - will be removed
rm -r /system/preloadedkiosk

# /system/preloadedsso - Knox Bloatware (will be removed)
echo fixing permissions for /system/preloadedsso - Knox Bloatware - will be removed
rm -r /system/preloadedsso

# /system/sipdb
echo fixing permissions for /system/sipdb
busybox chown 0.0 /system/sipdb/*
busybox chmod 655 /system/sipdb/*

# /system/tts
echo fixing permissions for /system/tts
busybox chown -R 0:0 /system/tts
find /system/tts \( -type d -exec busybox chmod 755 {} + \) -o \( -type f -exec busybox chmod 644 {} + \)

# /system/usr
echo fixing permissions for /system/usr
busybox chown -R 0:0 /system/usr
find /system/usr \( -type d -exec busybox chmod 755 {} + \) -o \( -type f -exec busybox chmod 644 {} + \)

# /system/vendor
echo fixing permissions for /system/vendor
find /system/vendor \( -type d -exec busybox chown 0.2000 {} + \) -o \( -type f -exec busybox chown 0.0 {} + \)
find /system/vendor \( -type d -exec busybox chmod 755 {} + \) -o \( -type f -exec busybox chmod 644 {} + \)

# /system/voicebargeindata
echo fixing permissions for /system/voicebargeindata
busybox chown -R 0:0 /system/voicebargeindata
find /system/voicebargeindata \( -type d -exec busybox chmod 755 {} + \) -o \( -type f -exec busybox chmod 644 {} + \)

# /system/vold
echo fixing permissions for /system/vold
busybox chown 0.0 /system/vold/*
busybox chmod 644 /system/vold/*

# /system/wakeupdata
echo fixing permissions for /system/wakeupdata
busybox chown -R 0:0 /system/wakeupdata
find /system/wakeupdata \( -type d -exec busybox chmod 755 {} + \) -o \( -type f -exec busybox chmod 644 {} + \)

# /system/wallpaper
echo fixing permissions for /system/wallpaper
busybox chown 0.0 /system/wallpaper/*
busybox chmod 644 /system/wallpaper/*

# /system/xbin
echo fixing permissions for /system/xbin
busybox chmod 755 /system/xbin/*
busybox chown 0.2000 /system/xbin/*
busybox chown -h 0.2000 /system/xbin/*
busybox chown 0.0 /system/xbin/su
busybox chmod 6755 /system/xbin/su
busybox chown 0.0 /system/xbin/daemonsu
busybox chmod 6755 /system/xbin/daemonsu

# <<< STOCK PERMISSIONS END <<<

# ==============================

# >>> ADDITIONAL PERMISSIONS >>>

echo
echo Step 3: Fixing additional permissions
echo -------------------------------------

# /system/photoreader
echo fixing permissions for /system/photoreader
busybox chown -R 0.2000 /system/photoreader/*
find /system/photoreader/ \( -type d -exec busybox chmod 755 {} + \) -o \( -type f -exec busybox chmod 644 {} + \)

# <<< ADDITIONAL PERMISSIONS END <<<