Users, groups, and others
Under Linux, every file is owned by exactly one user and one group. Every user has an identifying number, the User ID (UID). The same applies for a group: it is resolved by a Group ID (GID). Every user has exactly one UID and one primary GID; however, users can be members of multiple groups. In that case, the user will have one or more supplementary GIDs. You can see this for yourself by running the id
command on your Ubuntu machine:
reader@ubuntu:~$ id uid=1000(reader) gid=1004(reader) groups=1004(reader),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),108(lxd),1000(lpadmin),1001(sambashare),1002(debian-tor),1003(libvirtd) reader@ubuntu:~$
In the preceding output, we can see the following things:
- The
uid
for thereader
user is1000
; Linux typically starts numbering normal users at1000
- The
gid
is1004
, which corresponds to thereader
group; by default, Linux creates a group with the same name as the user (unless told specifically not to) - Other groups include
adm
,sudo...