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?
Asked
Active
Viewed 6,348 times
1

DasPete
- 831
- 2
- 18
- 37
1 Answers
2
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

alijandro
- 11,627
- 2
- 58
- 74
-
I see. I ran 'id' and it said that my ID is 10265(u0_a265). Is there any way to change my id so I can change that file to the proper owner and group? – DasPete Jun 13 '16 at 05:37
-
Generally you can not do that in a unrooted devices. – alijandro Jun 13 '16 at 06:08
-
Understood. I am rooted though. Shouldn't I be able to change ownership as root? I ran the command using 'su' that should do the trick right? I still get the not found error. – DasPete Jun 13 '16 at 06:13
-
Yes. `su` will work. after `su`, the prompt should be `#`, right? what is the `id` output after `su`? – alijandro Jun 13 '16 at 06:19
-
If I just run 'su' my prompt is 'user@android:/$' and 'id' still outputs as u0_a265. – DasPete Jun 13 '16 at 06:28
-
So `su` not successfully executed. Maybe the `su` doesn't work on your current ROM. You should find a new one. – alijandro Jun 13 '16 at 06:37
-
1Turns out it was because I was using a shell emulator the whole time. Works perfectly now on the developer terminal. Thanks for all your help! – DasPete Jun 13 '16 at 06:43