Advertisement
metalx1000

Android Restore App Permissions

Dec 8th, 2022
1,589
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.63 KB | None | 0 0
  1. #!/bin/sh
  2. if [ "$1" != "" ]; then
  3.  
  4.         #The folders in /data/data each have a different owner. The next line gets the owner and the strips the whitespace
  5.         appusername=$(stat -c "%U" /data/data/$1 | xargs)
  6.  
  7.         #The next line constructs the chown command to repair the permissions for all the files in the target folder
  8.         fixperm="chown -R $appusername:$appusername /data/data/$1/*"
  9.  
  10.         #Display the command to the user
  11.         echo "$fixperm"
  12.  
  13.         #Uncomment the next line if you would like the script to fix the permission
  14.         eval $fixperm
  15. else
  16.     echo "Missing target folder parameter"
  17. fi
  18.  
Tags: Android
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement