I used TWRP for installing the su command, and I installed SuperSU app from Google Play. It works.

The question - how su command works? It hasn't s-bit, so it can not change eUID. In what way it gets root's permissions?

shell@mako:/ $ id
uid=2000(shell) gid=2000(shell)
groups=1003(graphics),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

shell@mako:/ $ su

root@mako:/ # id
uid=0(root) gid=0(root) context=u:r:init:s0

root@mako:/ # which su

root@mako:/ # ls -l /system/xbin/su
-rwxr-xr-x root     root        75348 2016-10-29 22:31 su

root@mako:/ # 
  • 1
    What exactly are you asking or what problem are you trying to resolve? su is the Substitute User (sometimes switch user) utility that lets you change the active session's owner to root. If you want to see how the executable itself works, why not look at the sample How-To code? github.com/Chainfire/libsuperuser
    – acejavelin
    Nov 2, 2016 at 14:24
  • I know, how to use it. I do not know, why it works. On linux eUID could be changed only by programs with 's' bit. On my Android device 'su' command doesn't have 's' bit, but it works. How?
    – tse
    Nov 2, 2016 at 20:35
  • Chainfires explanations: su.chainfire.eu
    – Bo Lawson
    Jun 4, 2018 at 7:57


You must log in to answer this question.

Browse other questions tagged .