Ubuntu Unleashed 2019 Edition: Covering 18.04, 18.10, 19.04

(singke) #1

Different UNIX operating systems implement the group concept in various
ways. Ubuntu uses a scheme called UPG (user private group) in which the
default is that each user is assigned to a group with his or her own name. (The
user’s username and group name are identical.) All the groups on a system are
listed in /etc/group file.


Here is an example of a portion of the /etc/group file:


Click here to view code image
matthew@seymour:~$ cat /etc/group
root:x:0:
daemon:x:1:
bin:x:2:
sys:x:3:
adm:x:4:matthew
tty:x:5:
disk:x:6:
mail:x:8:
news:x:9:
fax:x:21:matthew
voice:x:22:
cdrom:x:24:matthew
floppy:x:25:matthew
tape:x:26:matthew
www-data:x:33:
crontab:x:107:
ssh:x:109:
admin:x:115:matthew
saned:x:116:
gdm:x:119:
matthew:x:1000:
ntp:x:122:


In this example, you see a number of groups, mostly for services (mail, news,
and so on) and devices (floppy, disk, and so on). As previously mentioned, the
system services groups allow those services to have ownership and control of
their files. For example, adding Postfix to the mail group enables the Postfix
application to access mail’s files such that mail can decide about group
access to its file. Adding a regular user to a device’s group permits the regular
user to use the device with permissions granted by the group owner. Adding
user matthew to the group cdrom, for example, allows matthew to use
the optical drive device. You learn how to add and remove users from groups
in the next section.


FINDING YOUR    GROUPS
You can find which groups your user account belongs to by using the
groups command, like this:
Free download pdf