Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

getting error while using "su" command

I try to make batch file to run adb commands. I want to use su -c, but I get the error:

 su: invalid uid/gid '-c'. 

I saw somewhere that my su version doesn't support -c, how can I enable this?

like image 436
yehonatan Avatar asked Oct 06 '15 06:10

yehonatan


People also ask

Why is my su Authentication failure?

This problem usually occurs when you change the ownership of /usr/bin from root to an ordinary user or you have mistakenly granted both the owner, the group and others the full permission to read, write and execute (rwxrwxrwx) to the /usr/bin directory by running sudo chmod 777 /usr/bin/ or by granting the owner and ...

How do I enable su command?

To provide sudo access, the user has to be added to the sudo group. The su command lets you switch the current user to any other user. If you need to run a command as a different (non-root) user, use the –l [username] option to specify the user account.

How do I enable su to root?

Step 1: Go to System -> Administration -> Login window. Step 2: In the Security tab, click on the check box “Allow local system administrator” as shown below. After this change, reboot the system and login directly using root account.


2 Answers

In batch file it should be like this:

adb shell "su 0 <command args>"

For example:

adb shell "su 0 mount -o rw,remount /system"
like image 192
desperius Avatar answered Oct 13 '22 01:10

desperius


The standard Android su is much simpler than its regular linux counterpart. It does not support any commands other than -c - so it's become redundant.

usage: su [UID[,GID[,GID2]...]] [COMMAND [ARG...]]

like image 32
Alex P. Avatar answered Oct 13 '22 00:10

Alex P.