android shell toolbox权限限制

来源:互联网 发布:mac屏幕截图快捷键 编辑:程序博客网 时间:2024/05/01 10:14

我们平时在开发安卓平台的时候会用到大量的shell tool,chmod reboot netcfg ifconfig等等诸如此类。

busybox是一个超级工具集合,在reboot的时候按照配合使用超级爽,当然了也有很多厂家直接集成了busybox的工具集。


其实,翻来覆去,还是原生自带的一些系统命令对权限的管理很死板,不好用。

下面我们就来看看一些命令的权限限制:

1、su权限限制

/system/extras/su/su.c 

很多厂家做出来的su,加入了uid的检查,所以在ROOT的时候,一般都不会用厂商自己的su bin文件

    /* Until we have something better, only root and the shell can use su. */
    myuid = getuid();

    if (myuid != AID_ROOT && myuid != AID_SHELL) {
        fprintf(stderr,"su: uid %d not allowed to su\n", myuid);
        return 1;
    }

(以上代码就会导致只有ROOT 和SHELL 权限组的用户才能使用原生su)

0 0