Ubuntu Unleashed 2019 Edition: Covering 18.04, 18.10, 19.04

(singke) #1

As previously mentioned, the root user is UID 0. Numbers from 1 through
499 and number 65,534 are the system, sometimes called logical users, or
pseudo-users. Regular users have UIDs beginning with 1,000; Ubuntu assigns
them sequentially, beginning with this number.


With only a few exceptions, the GID is the same as the UID.


Ubuntu creates a private GID for every UID of 1,000 and greater. The system
administrator can add other users to a GID or create a totally new group and
add users to it. Unlike in Windows NT and some UNIX variants, a group in
Ubuntu (or any other Linux distribution) cannot be a member of another
group.


File Permissions


There are three types of permissions: read, write, and execute (r, w, x). For
any file or directory, permissions are assigned to three categories: user, group,
and other. This section focuses on group permissions. First, though, we want
to highlight three commands used to change the group, user, or access
permissions of a file or directory:


chgrp—Changes   the group   ownership   of  a   file    or  directory
chown—Changes the owner of a file or directory
chmod—Changes the access permissions of a file or directory

You can use these commands to reproduce organizational structures and
permissions in the real world in your Ubuntu system (see the next section,
“Managing Groups”). For example, a human resources department can share
health-benefit memos to all company employees by making the files readable
(but not writable) by anyone in an accessible directory. Programmers in the
company’s research and development section, although able to access each
other’s source code files, would not have read or write access to HR pay scale
or personnel files—and certainly would not want HR or marketing poking
around R&D.


These commands are used to easily manage group and file ownerships and
permissions from the command line. It is essential that you know these
commands because there are times when you are likely to have only a
command-line interface to work with. (There was a time when a well-
meaning but fat-fingered system administrator set incorrect permissions on
X11, rendering the system incapable of working with a graphical interface.
No, we won’t tell that story, but if you press them, most systems
administrators have similar tales of woe.)

Free download pdf