Android chown recursively

Stock Android chown in /system/bin/chown doesn’t support the recursive switch which I discovered when I was trying to manually change owners and groups on an app folder.
chown -R u0_a160:u0_a160 databases/
resulted in the error message No such user '-R'.

So you need to use Android Busybox chown:
busybox chown -R 10160:10160 databases/

Install Busybox first if you don’t have it, obviously. Note you need to use numeric UID/GIDs with busybox chown or you’ll get an unknown user error message. Find numeric owners and groups with the -n switch: busybox ls -l -n /data/data

Published by Georgie Casey

student. Google+

Join the Conversation

2 Comments

  1. Hi. thanks for your post.

    I’m wondering how/if chown could be used for me to take ownership of an ext3 partition on my internal drive? I’m having trouble accesing it. firstly, because it is internal. And secondly, because it seeems I probably don’t have permission to access it (even in read-only).

    Or do you know of any other tecniques that may work? (I’m not above flattening it, if I need to recreate in from within android (running android-x86)

    cheers
    M.

  2. Also, for those who don’t want to or cannot install busybox you can use the find command and have it execute chown on every file below a folder:

    find somefolder -exec chown u0_a105:u0_a105 {} \;

    Here chown is call on every file in “somefolder” and sets the user and group to u0_a105

Leave a comment

Your email address will not be published. Required fields are marked *