Search code examples
androidlinuxchownandroid-shell

Android shell chown u0_49


I'm having some trouble with changing owner in the shell on my android. I'm trying to change the owner and group of a file to match another file in the directory. When I ls -l the other files have an owner of u0_a49 I tried to su chown u0_a49:u0_49 When I tried that I got the error tmp-mksh: u0_a49:u0_a49: not found I tried it with u0_a49.u0_a49 as well and no luck. Any idea why I can't set this permission?


Solution

  • What is the id of your current user who execute chown? You can only change ownership to your own user id and group id in Android.

    $ id
    uid=2000(shell) gid=2000(shell) groups=2000(shell),1004(input),1007(log),1011(adb),1015(sdcard_rw),1028(sdcard_r),3001(net_bt_admin),3002(net_bt),3003(inet),3006(net_bw_stats) context=u:r:shell:s0
    $ chown shell.shell file
    $ chown 2000.2000 file # use the gid.uid style