简体   繁体   English

Linux中的UID是什么?

[英]what is UID in linux?

what is UID in linux? Linux中的UID是什么? Wiki and other online sources say it is user ID. Wiki和其他在线资源说这是用户ID。 But what exactly is user id? 但是,用户ID到底是什么? The name "user id" gives me a sense that it is the user who is using the OS. 名称“用户ID”使我感觉是使用操作系统的用户。 Like If I have only one user, my user id should be 1. For root, I understand that it is 0. 就像如果我只有一个用户,我的用户ID应该是1。对于root用户,我知道它是0。

But I see that the user id is given to every process(application ?). 但是我看到用户ID分配给了每个进程(应用程序?)。 So, does every process has a different uid? 那么,每个进程是否都有不同的uid? Why is it needed when we have pid already to distinguish them. 当我们已经有了pid来区分它们时,为什么需要它。

Ex :
root:/ # ps 8533
USER     PID   PPID  VSIZE  RSS     WCHAN    PC        NAME
u0_a78    8533  363   1526628 52668 ffffffff b6f80d04 S com.google.android.keep

root:/ # cat /proc/8533/status
Name:   le.android.keep
State:  S (sleeping)
Tgid:   8533
Pid:    8533
PPid:   363
TracerPid:  0
Uid:    10078   10078   10078   10078
....

So here for the process google keep, the UID is 10078. So, are there more than 10000 users? 因此,对于Google保留的进程,此处的UID为10078。那么,是否有超过10000个用户? If yes, then Who exactly is a user? 如果是,那么用户到底是谁?

UID is the Linux user ID. UID是Linux用户ID。

User IDs don't have to start counting at 0 or 1. There's nothing that says that user IDs go up from 0, 1, 2, ... etc. so there is nothing strange with the fact that the UID is 10078. 用户ID不必从0或1开始计数。没有什么可以说用户ID从0、1、2 ...等开始递增的,因此UID为10078并不奇怪。

On Android, every app gets its own Linux user. 在Android上,每个应用都有自己的Linux用户。 This is done for security management reasons; 这样做是出于安全管理的原因; the permissions for each user = each app can be managed at the OS level in this way. 每个用户的权限=每个应用都可以通过这种方式在操作系统级别进行管理。 Every time you install a new app, a new Linux user is created for that app. 每次安装新应用程序时,都会为该应用程序创建一个新的Linux用户。

This is explained in more detail in: Android System Permissions 在“ Android系统权限”中对此有更详细的说明。

The Linux user is an operating system level user, and does not have any direct relation to the person who is using the Android device. Linux用户是操作系统级别的用户,与使用Android设备的用户没有任何直接关系。

我注意到,在Android中(至少5和6),任何大于10000的uid都对应于非系统用户,即非系统应用程序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM