Everyday Guidebooks
Cover of Linux Essentials

Cybersecurity & IT

Linux Essentials: Users, Groups, and System Identity

An Unofficial Guide to Account Records, Identifiers, and Administrative Privileges

by Todd Michael

Available now

What does Linux actually know about a user? Why can two accounts share a group, and what makes an administrative account different from an ordinary one?

Linux Essentials: Users, Groups, and System Identity answers those questions with a focused tour of the identity concepts that beginning Linux learners and certification candidates need to understand. Follow text-based examples that show how user IDs and group IDs work, how account records connect names to numbers, and how ordinary privileges differ from administrative authority.

Inside, you will examine common identity-related commands, read representative account and group records, explore password and account status concepts, and work through original review questions with explanations. A final set of integrated scenarios helps you connect the pieces rather than memorize isolated terms.

This independent, unofficial linux essentials resource concentrates on users, groups, and system identity; it is not a complete certification exam guide.

Contents
  1. 1. Identity on a Linux System
  2. 2. User Names and User IDs
  3. 3. Group Names and Group IDs
  4. 4. Reading User Account Records
  5. 5. Reading Group and Shadow Records
  6. 6. Account Types and Login Context
  7. 7. Passwords and Account Status
  8. 8. Creating and Modifying User Accounts
  9. useradd mchen
  10. useradd -m -s /bin/bash -c "Maya Chen" mchen
  11. useradd -m -d /home/mchen -s /bin/bash mchen
  12. useradd -m -u 2105 -s /bin/bash mchen
  13. useradd -m -g editors -s /bin/bash mchen
  14. passwd mchen
  15. usermod -s /bin/bash mchen
  16. usermod -c "Maya Chen, Documentation" mchen
  17. usermod -l maya mchen
  18. usermod -d /home/maya -m maya
  19. usermod -u 2110 mchen
  20. usermod -g editors mchen
  21. usermod -L mchen
  22. userdel mchen
  23. userdel -r mchen
  24. 9. Managing Groups and Membership
  25. From group records to membership
  26. Read the current state first
  27. Creating a group with `groupadd`
  28. Adding a supplementary member
  29. Appending is not replacing
  30. Changing a primary group
  31. Renaming a group with `groupmod`
  32. Changing a GID is different from renaming
  33. Removing a group with `groupdel`
  34. Why the new membership may not work yet
  35. A short administration walkthrough
  36. Review questions
  37. 10. Identity and File Ownership
  38. 11. Root and Administrative Authority
  39. groupadd reviewers
  40. 12. Changing and Delegating Identity

Read a sample: 1. Identity on a Linux System

When you open a file on a Linux computer, the system does not ask whether you are a trustworthy person. It evaluates a request made by a running program. That program operates with an identity, and Linux uses that identity—along with permissions and other security controls—to help decide whether the request should succeed.

This distinction is the foundation of user and group administration. A person may know an account by a convenient name such as maya, but the system also associates that name with numerical identifiers. Files have owners and groups. Processes carry user and group credentials. Administrative authority can depend on which identity is active and what local policy permits.

This chapter introduces those ideas without asking you to change a real account. It also establishes a fictional lab and a way to read the examples throughout the book.

A Linux user account is a collection of identity information that allows the system and its programs to recognize a user. An account has a user name and a user ID, commonly abbreviated UID. It is also associated with a primary group ID, or GID, and may be associated with supplementary groups.

An account is not necessarily a person. A system may have accounts intended for services or other system functions, as well as accounts used interactively by people. Conversely, a person can have more than one account: perhaps an ordinary account for daily work and a separate account for a specialized administrative role.

For the examples in this book, imagine a small Linux lab with these fictional accounts:

- maya is an ordinary user who works with shared project files. - leo is another ordinary user who works on the same project. - root is the superuser account, associated with UID 0. - A service account may appear in examples when a program needs its own identity.

The shared project group is named projects. Maya and Leo may both belong to it, depending on the example. Their account names, group names, and numerical identifiers are illustrative; they are not claims about the accounts on your computer.

A login name is the name supplied or selected when starting a session, such as maya. Authentication is the process of establishing that the person or program is entitled to use an identity. A password may be involved, but authentication methods vary. Once a session begins, programs launched from it generally run with credentials derived from that session.

It helps to separate three questions:

1. Identification: Which account is being requested? 2. Authentication: Is the requester allowed to use that account? 3. Authorization: Is the resulting identity permitted to perform a particular action?

For example, Maya might authenticate successfully and start a session, yet still be denied access to a file owned by someone else. Logging in and being allowed to read every file are different matters.

A process is a running instance of a program. A text editor, a shell, and a web server can each run as processes. When a process requests access to a file or another protected resource, the system evaluates the request using the process’s credentials and the relevant access controls.

Suppose Maya signs in and starts a text editor. The editor normally runs with Maya’s user and group credentials. If she asks it to open a project file, the editor makes the request. Linux does not inspect Maya’s real-world job title; it evaluates the credentials of the process and the protections on the file.

A process can carry more than one user or group identifier for different purposes. Programs can also be designed to change credentials under particular conditions. For now, focus on the central idea: the identity used for an access decision belongs to the process making the request. It is not simply a label typed at a login screen.

This helps explain why two programs can have different access even when the same person started or interacts with both. Maya might have an ordinary shell and, separately, run an approved administrative command under a different identity. A service, meanwhile, can act without a person at a keyboard, using credentials associated with its own process.

User and group names make administration readable. Linux also uses numerical identifiers to represent identities and ownership. Consider this fictional mapping:

text User name: maya User ID: 1001 Group name: projects Group ID: 2200

A command may display maya for a file owned by UID 1001 when it can resolve the number to that name. If the name changes, the numerical ownership can remain the same. Chapter 2 explores UIDs and ownership in more detail.

A group can support shared access: an administrator can arrange for a file’s group and permissions to allow access to members of projects. Chapter 3 examines primary and supplementary groups and how to inspect them.

Names and numbers do not explain every access decision by themselves. File permission bits, access control lists, security policies, and other controls can also matter.

The examples use a fictional Linux computer called labhost. Maya is the ordinary user at its command line. Unless a section says otherwise, assume that she has opened a terminal in a practice environment and is not working as root.

A command example may look like this:

console maya@labhost:~$ whoami maya

The parts have distinct roles:

- maya@labhost identifies the illustrative user and computer shown in the prompt. - ~ represents Maya’s home directory in this…

More Cybersecurity & IT

Cover of The White Hat Bible, Volume 1The White Hat Bible, Volume 1Available nowCover of The White Hat Bible, Volume 2The White Hat Bible, Volume 2Available nowCover of The White Hat Bible, Volume 3The White Hat Bible, Volume 3Available nowCover of The White Hat Bible, Volume 4The White Hat Bible, Volume 4Available nowThe White Hat Bible, Volume 5Available nowCover of The White Hat Pocket GuideThe White Hat Pocket GuideAvailable now

About Todd Michael

Todd Michael is an American author and the founder of ToddMichael.tv. He writes practical, plain-English books on money, health, preparedness, technology, games, humor and more.

About the author Todd Michael · Todd Michael’s author site

Part of the ToddMichael.tv network.