what 's difference between android system user and linux root user
来源:互联网 发布:docker nginx 配置 编辑:程序博客网 时间:2024/06/06 19:37
摘自: http://stackoverflow.com/questions/16933108/what-s-difference-between-android-system-user-and-linux-root-user
Q: When I connect my phone to computer,then I use "adb shell" command to communicate with my phone and input ps command to output processes info that currently run on my phone,I find two special users,one is root,the other is system,as far as I know,android based on linux,so root user is the bigest authority user,but I confuse with system user,maybe I can consider it as a normal user in linux system,But it is special in Android,it has a lot of permissions related to android,so Can someone tell me the real different between root user and system user,and why android need to add a system user?thanks:)
A:
s far as Linux is concerned, the system
user is just a regular user (UID 1000). Android services however give it special permissions and you can get access to pretty much anything. Most services have code like this somewhere:
private static final void enforceSystemOrRoot(String message) { final int uid = Binder.getCallingUid(); if (uid != Process.SYSTEM_UID && uid != 0) { throw new SecurityException(message); }}
What that does is deny access to anyone who is not root or system
. Theshell
user (UID 2000) (what you get when doing adb shell
) is another user with a lot of power (member of many groups). Cf.
system
:
$ su 1000 $ id uid=1000(system) gid=1000(system) groups=1003(graphics),1004(input),1007(log),1009(mount), 1011(adb),1015(sdcard_rw),1028(sdcard_r),3001(net_bt_admin), 3002(net_bt),3003(inet),3006(net_bw_stats)
shell
:
$ adb shellshell@android:/ $ iduid=2000(shell) gid=2000(shell) groups=1003(graphics),1004(input),1007(log),1009(mount),1011(adb),1015(sdcard_rw),1028(sdcard_r),3001(net_bt_admin),3002(net_bt),3003(inet),3006(net_bw_stats)
Android uses a separate user for every app, and system services also have their dedicated users (media
,radio
, wifi
, etc.). Very few thins run as root (mostly native daemons).
system user can not access other user's files.
If you do:ls -l /data/data/com.google.android.gm/shared_prefs/
You will got 'permission denied'
If you are root user, you can do anything.You can access all the file system, wipe all the data.
You can also reboot the phone, etc.
- what 's difference between android system user and linux root user
- What is the difference between User Control and Custom Control?
- What is the difference between user mode and kernel mode, and real mode and protected mode?
- What is the difference between user level threads and kernel level threads?
- What's difference between PMP and PRINCE2
- What's the difference and connection between API(Application Programming Interface) and SC(System Call)?
- the difference between kernel stack and user stack
- What's the difference between an event and a delegate?
- what's the difference between OnDraw and OnPaint
- What's the difference between stack and heap?
- What's the difference between LastWriteTime and ChangeTime in FILE_BASIC_INFO?
- What's the difference between Heap and Stack
- What's the difference between overload and override
- What's the difference between glibc and libc6?
- What's the difference between "but" and "yet"
- What's+the+difference+between+virtualization+and+cloud+computing?
- What's the difference between parallel and concurrent?
- What's the difference between program arguments and VM arguments?
- 方法重写2
- DelayQueue延时队列的使用
- web开发入门--配置
- Flex4中模块加载char
- VC++系统学习笔记(一)
- what 's difference between android system user and linux root user
- ubuntu下修改MySQL的配置文件my.cnf
- UVa 11827 - Maximum GCD
- scull的阅读笔记
- 华为OJ
- 云计算课程详解
- 第九周项目三 b
- kmp
- 2015百度校园招聘移动端研发工程师面试小计(Android篇)