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)
Code:
#!/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 <<<
RESERVED
zroice said:
RESERVED
Click to expand...
Click to collapse
Thanks for this, just what is was needing on my N3...
The thing is, I cannot boot the system... can you help me to run it on CWM recovery? Maybe converting it into a 'flashable script'?
this stuff is old - the kn0x0ut toolbox includes the current version of the fix permission script.
This should also work over adb on recovery. But you need some adb skills.
zroice said:
...
There might be some redundancy within the script, but I wanted to better be safe
...
Click to expand...
Click to collapse
I wonder if (for max safety) you might need to add selinux refresh stuff in some places?
Related
http://www.sdx-downloads.com/devs/noobnl/initramfs.tar.gz
possible root exploit
cat /sbin/dfta > /data/dfta
chmod 777 /data/dfta
chown root.root /data/dfta
Hi.
Im added FLAC support for Motorola Charm T-Mobile.
This is modified framework.jar via smali\backsmali
Flac *.so files here
put framework jar and *.so in /sdcard/flac/
than copy script
Code:
#!/system/bin/sh
mount -o remount,rw /dev/mtd/mtdblock7 /system
echo "remounting done"
cp -f /sdcard/flac/framework.jar /system/framework
cp -f /sdcard/flac/libFLAC.so /system/lib
cp -f /sdcard/flac/libmediaplayerservice.so /system/lib
cp -f /sdcard/flac/libopencore_player.so /system/lib
echo "files was copied"
chmod 644 /system/framework/framework.jar
chmod 644 /system/lib/libFLAC.so
chmod 644 /system/lib/libmediaplayerservice.so
chmod 644 /system/lib/libopencore_player.so
echo "remounting RO"
mount -o remount,ro /dev/mtd/mtdblock7 /system
in /sdcard/
execute it
chmod 777 script.sh
sh script.sh
reboot your phone
play flac
Dont forget backup own framework.jar and other files.
Admin, plz, add forum for MOTOROLA CHARM
Links are dead.
Can you please upload these files again?
Hello, can you tell how could I make system.img file From a system.zip file?
I hope this helps:
Code:
So here is how you do it.
First create a directory to unzip or un-tar all the files into. I called mine system_orig
Then this is my script to build a system.img The harder part is getting the IMG file size correct. You have to watch out making it too big as the parameter file defines how big system can be. If yours is bigger than what the parameter file allows, you will need to adjust the parameter file. I believe most parameter files today allow up to 500megs.
#create the system dir
mkdir system2
# create the system image using DD. Set size here:
dd if=/dev/zero of=system.img count=471000000
#format the image you just created. This is EXT4 but you can use anything the kernel allows as defined in init.rc
sudo /sbin/mkfs.ext4 -q system.img
#Now mount it in Linux
sudo mount -o loop system.img system2
# Now copy everything from your unzipped folder into the new image.
sudo cp -r system_orig/* system2
#OK lets create all the symbolic links
#make symlinks
sudo ln -s Roboto-Bold.ttf system2/fonts/DroidSans-Bold.ttf
sudo ln -s Roboto-Regular.ttf system2/fonts/DroidSans.ttf
sudo ln -s mksh system2/bin/sh
sudo ln -s toolbox system2/bin/cat
sudo ln -s toolbox system2/bin/chmod
sudo ln -s toolbox system2/bin/chown
sudo ln -s toolbox system2/bin/cmp
sudo ln -s toolbox system2/bin/date
sudo ln -s toolbox system2/bin/dd
sudo ln -s toolbox system2/bin/df
sudo ln -s toolbox system2/bin/dmesg
sudo ln -s toolbox system2/bin/getevent
sudo ln -s toolbox system2/bin/getprop
sudo ln -s toolbox system2/bin/hd
sudo ln -s toolbox system2/bin/id
sudo ln -s toolbox system2/bin/ifconfig
sudo ln -s toolbox system2/bin/iftop
sudo ln -s toolbox system2/bin/insmod
sudo ln -s toolbox system2/bin/ioctl
sudo ln -s toolbox system2/bin/ionice
sudo ln -s toolbox system2/bin/kill
sudo ln -s toolbox system2/bin/ln
sudo ln -s toolbox system2/bin/log
sudo ln -s toolbox system2/bin/ls
sudo ln -s toolbox system2/bin/lsmod
sudo ln -s toolbox system2/bin/lsof
sudo ln -s toolbox system2/bin/md5
sudo ln -s toolbox system2/bin/mkdir
sudo ln -s toolbox system2/bin/mount
sudo ln -s toolbox system2/bin/mv
sudo ln -s toolbox system2/bin/nandread
sudo ln -s toolbox system2/bin/netstat
sudo ln -s toolbox system2/bin/newfs_msdos
sudo ln -s toolbox system2/bin/notify
sudo ln -s toolbox system2/bin/printenv
sudo ln -s toolbox system2/bin/ps
sudo ln -s toolbox system2/bin/r
sudo ln -s toolbox system2/bin/reboot
sudo ln -s toolbox system2/bin/renice
sudo ln -s toolbox system2/bin/rm
sudo ln -s toolbox system2/bin/rmdir
sudo ln -s toolbox system2/bin/rmmod
sudo ln -s toolbox system2/bin/route
sudo ln -s toolbox system2/bin/schedtop
sudo ln -s toolbox system2/bin/sendevent
sudo ln -s toolbox system2/bin/setconsole
sudo ln -s toolbox system2/bin/setprop
sudo ln -s toolbox system2/bin/sleep
sudo ln -s toolbox system2/bin/smd
sudo ln -s toolbox system2/bin/start
sudo ln -s toolbox system2/bin/stop
sudo ln -s toolbox system2/bin/sync
sudo ln -s toolbox system2/bin/top
sudo ln -s toolbox system2/bin/touch
sudo ln -s toolbox system2/bin/umount
sudo ln -s toolbox system2/bin/uptime
sudo ln -s toolbox system2/bin/vmstat
sudo ln -s toolbox system2/bin/watchprops
sudo ln -s toolbox system2/bin/wipe
#OK now lets set all the permissions
sudo chown -R 0:0 system2
sudo chmod -R 0755 system2
sudo find system2 -type d -exec chmod 0755 {} \;
sudo find system2 -type f -exec chmod 0644 {} \;
sudo chown -R 0:2000 system2/bin
sudo chmod 0755 system2/bin
sudo find system2/bin -type d -exec chmod 0755 {} \;
sudo find system2/bin -type f -exec chmod 0755 {} \;
sudo chown 0:3003 system2/bin/netcfg
sudo chmod 2750 system2/bin/netcfg
sudo chown 0:3004 system2/bin/ping
sudo chmod 2755 system2/bin/ping
sudo chown 0:2000 system2/bin/run-as
sudo chmod 6755 system2/bin/run-as
sudo chown -R 1002:1002 system2/etc/bluetooth
sudo chmod 0755 system2/etc/bluetooth
sudo find system2/etc/bluetooth -type d -exec chmod 0755 {} \;
sudo find system2/etc/bluetooth -type f -exec chmod 0440 {} \;
sudo chown 0:0 system2/etc/bluetooth
sudo chmod 0755 system2/etc/bluetooth
sudo chown 1000:1000 system2/etc/bluetooth/auto_pairing.conf
sudo chmod 0640 system2/etc/bluetooth/auto_pairing.conf
sudo chown 3002:3002 system2/etc/bluetooth/blacklist.conf
sudo chmod 0444 system2/etc/bluetooth/blacklist.conf
sudo chown 1002:1002 system2/etc/dbus.conf
sudo chmod 0440 system2/etc/dbus.conf
sudo chown 1014:2000 system2/etc/dhcpcd/dhcpcd-run-hooks
sudo chmod 0550 system2/etc/dhcpcd/dhcpcd-run-hooks
sudo chown 0:2000 system2/etc/init.goldfish.sh
sudo chmod 0550 system2/etc/init.goldfish.sh
sudo chown 0:0 system2/etc/install-recovery.sh
sudo chmod 0544 system2/etc/install-recovery.sh
sudo chown -R 0:0 system2/etc/ppp
sudo chmod -R 0755 system2/etc/ppp
sudo find system2/etc/ppp -type d -exec chmod 0755 {} \;
sudo find system2/etc/ppp -type f -exec chmod 0555 {} \;
sudo chown -R 0:2000 system2/vendor
sudo chmod -R 0755 system2/vendor
sudo find system2/vendor -type d -exec chmod 0755 {} \;
sudo find system2/vendor -type f -exec chmod 0644 {} \;
sudo chown -R 0:2000 system2/xbin
sudo chmod -R 0755 system2/xbin
sudo find system2/xbin -type d -exec chmod 0755 {} \;
sudo find system2/xbin -type f -exec chmod 0755 {} \;
sudo chown 0:0 system2/xbin/librank
sudo chmod 06755 system2/xbin/librank
sudo chown 0:0 system2/xbin/procmem
sudo chmod 06755 system2/xbin/procmem
sudo chown 0:0 system2/xbin/procrank
sudo chmod 06755 system2/xbin/procrank
sudo chown 0:0 system2/xbin/tcpdump
sudo chmod 06755 system2/xbin/tcpdump
# Note I added this to ROOT the new ROM. I simply copied in SU and Superuser and busybox.
# However if you want stock remove this area.
# Also note, some only put busybox and SU in /bin or /xbin. I usually do both.
sudo chown 0:0 system2/bin/su
sudo chmod 06755 system2/bin/su
sudo chown 0:0 system2/xbin/su
sudo chmod 06755 system2/xbin/su
sudo chown 0:0 system2/bin/busybox
sudo chmod 6755 system2/bin/busybox
sudo chown 0:0 system2/xbin/busybox
sudo chmod 6755 system2/xbin/busybox
sudo chown 0:0 system2/app/Superuser.apk
sudo chmod 6755 system2/app/Superuser.apk
# OK now lets unmount system.img
sudo umount system2
# for clean up I usually delete system2 folder.
sudo rm -f -R system2
Sorry I don't know the use of ADB. Any other easy method for Windows?
I wrote a script for init.d , but its not running properly on boot.
Code:
#!/system/bin/sh
# init.d (startup scripts) permission fixer.
mount -o remount,rw -t auto /system
chown -R 0.0 /system/etc/init.d
chown -R 0:0 /system/etc/init.d
chmod -R 777 /system/etc/init.d
chcon u:object_r:system_file:s0 /system/etc/init.d
chcon u:object_r:system_file:s0 /system/etc/init.d/*
echo "Init.d is working !!!" > /data/Test.log
echo "excecuted on \$(date +"%d-%m-%Y %r" )" >> /data/Test.log
echo "Init.d is working !!!" > /sdcard/Test.log
echo "excecuted on \$(date +"%d-%m-%Y %r" )" >> /sdcard/Test.log
mount -o remount,ro -t auto /system
The problem is that
Code:
echo "Init.d is working !!!" > /sdcard/Test.log
echo "excecuted on \$(date +"%d-%m-%Y %r" )" >> /sdcard/Test.log
Its not creats the "Test.log" output file in "sdcard" .
I don't know why its not creats the "Test.log" output file in "/sdcard/Test.log" is there any wrong with scripts or some thing I've missed.??
I wanted to share a script for cleaning all caches without rebooting to recovery. If this is the wrong place please forgive me or if its already posted forgive me I have never seen it. Just thought it may be helpful to some.
1) Download a script manager or if you already have one next step
2) Copy code below
3) Open create section in script manager
4) Past copied code save script.
5) Run and enjoy
HTML:
#!/system/bin/sh
busybox find /data/dalvik-cache -type d -iname "*cache*" -exec busybox rm -f {}/* ';'
busybox find /data/data -type d -iname "*cache*" -exec busybox rm -f {}/* ';'
busybox find /cache -type d -iname "*cache*" -exec busybox rm -f {}/* ';'
busybox find /system/app -type d -iname "*cache*" -exec busybox rm -f {}/* ';'
busybox find /system/priv-app -type d -iname "*cache*" -exec busybox rm -f {}/* ';'
busybox find /data/data -type d -iname "*cache*" -exec busybox rm -f {}/* ';' -exec echo "Cleared all caches{}" ';'