Files
Overview
The UNIX directory
hierarchy
Filesystems
Manipulating files
Creating
directories
Creating files
links
'Dot' files
Protecting files
Groups
File access
control
Changing
privileges
File
contents
Text files
Comparing
files
Filtering
files
Non-text files
Printing
files
File archives and file
compression
Other relevant commands
Summary
Exercises
|
Groups
The system administrator manages a database of
groups. Each group is a list of users and is given
a name (such as ugrads , general or
proj ). The reason for having groups is that when
access to software or data needs to be restricted, a group can be
used to specify this. Each user is a member of one or more groups,
and each file is allocated to exactly one group. At any particular
time, for each user there is a group that is the default group for
new files they create. Each group has a unique name and also a
unique number (its group-id or
GID). The command id ('identifier')
is used to interrogate the database, and on its own displays the
user's name together with the groups they are a member of, both
names and numbers, and the user's user-id and current group-id. If
you give id an argument that is another user's
username, then the information for that user will be displayed
instead. For example,
$ id chris
uid=145(chris) gid=12(ugrads)
groups=12(ugrads),417(proj)
shows that user chris is a member of groups
ugrads and proj , with GID numbers
12 and 417 respectively. Currently
chris is allocated to group ugrads .
Notice also that id has displayed a number for
chris , namely 145 - each user is also
allocated a unique number, their user-id or
UID. In order to change your current group-id,
command newgrp ('new group') should be invoked.
Followed by the name of a group of which you must be a
member this will perform the required change. With no
argument, it will return you to your default group-id as defined in
the password file. For example, if you are user chris ,
and wish to change your allocated group to proj , so
that you can control access to users in group proj
when you create new files:
$ newgrp proj
$ id
uid=145(chris) gid=417(proj) groups=12(ugrads),417(proj)
|