Lab 03 — Linux IAM
Linux security begins with a fundamental question:
Who Can Accessthe System?But enterprise Identity and Access Management goes further:
WHO ↓Can Access ↓WHAT ↓Using WhichPRIVILEGES ↓Under WhichCONDITIONSIn this lab, you will build a practical Linux IAM environment and learn how Linux controls identities, groups, permissions, administrative privileges, service accounts, and remote access.
Mission Information
Section titled “Mission Information”Lab: Linux IAM
Level: Intermediate
Estimated Time: 120–180 minutes
Environment: Authorized disposable Linux VM
Primary Role: Linux Security Administrator
Secondary Roles: Cloud Security Engineer, SOC Analyst, IAM Engineer, DevSecOps Engineer
Mission Scenario
Section titled “Mission Scenario”Your organization is preparing a Linux server for three teams:
Developers
Operations
SecurityThe security team has asked you to design and validate access according to least privilege.
The requirements are:
Developers ↓Access Development Files
Operations ↓Perform Approved Administration
Security ↓Read Security Evidence
Applications ↓Use Dedicated Service IdentityUsers must not receive unnecessary access simply because it is convenient.
Your mission is to implement:
Identity ↓Group Membership ↓Resource Ownership ↓Permissions ↓ACL ↓Administrative Privilege ↓SSH Access ↓Audit and ReviewLearning Objectives
Section titled “Learning Objectives”By completing this lab, you should be able to:
- Understand Linux identities
- Explain UID and GID
- Review local accounts
- Create and manage users
- Create and manage groups
- Design role-based group membership
- Manage account lifecycle
- Review password and aging controls
- Lock and unlock training accounts
- Understand file ownership
- Configure standard Linux permissions
- Understand special permissions
- Configure Access Control Lists
- Review sudo access
- Apply least privilege to administrative access
- Understand service accounts
- Review SSH-key-based access
- Identify orphaned or excessive access
- Perform a privileged-access review
- Produce an IAM assessment report
Lab Architecture
Section titled “Lab Architecture” Linux Server | +---------------+---------------+ | | | v v v Developers Operations Security | | | v v v devteam opsadmin secteam | | | +---------------+---------------+ | v Linux Resources | +---------------+---------------+ | | | v v v Files Services LogsIAM Mental Model
Section titled “IAM Mental Model”Use this model throughout the lab:
IDENTITY ↓AUTHENTICATION ↓GROUP / ROLE ↓AUTHORIZATION ↓RESOURCE ↓AUDITAuthentication vs Authorization
Section titled “Authentication vs Authorization”Do not confuse these concepts.
Authentication
Section titled “Authentication”Answers:
Who Are You?Examples:
Password
SSH Key
Central Identity
MFAAuthorization
Section titled “Authorization”Answers:
What Are YouAllowed to Do?Examples:
File Permissions
Group Membership
ACL
sudo
Application RolesPart 01 — Prepare the Lab
Section titled “Part 01 — Prepare the Lab”Create a workspace:
mkdir -p ~/linux-iam-labEnter it:
cd ~/linux-iam-labCreate:
mkdir evidence reportsStep 01 — Confirm Your Identity
Section titled “Step 01 — Confirm Your Identity”Run:
whoamiThen:
idRecord:
Username:
UID:
Primary GID:
Supplementary Groups:
Administrative Access:Step 02 — Review Current Users
Section titled “Step 02 — Review Current Users”Run:
getent passwdEach account generally contains information representing:
Username ↓UID ↓Primary GID ↓Description ↓Home Directory ↓Login Shell/etc/passwd
Section titled “/etc/passwd”You can inspect:
cat /etc/passwdDespite its name, modern Linux systems do not normally store plaintext passwords here.
Step 03 — Inspect Your Own Account
Section titled “Step 03 — Inspect Your Own Account”Run:
getent passwd "$(whoami)"Record:
Username:
UID:
GID:
Home Directory:
Shell:Part 02 — Understand UID
Section titled “Part 02 — Understand UID”Linux internally identifies users primarily through:
UIDnot simply usernames.
Conceptually:
Username ↓UID ↓Linux KernelA username is a human-friendly representation of an identity.
Step 04 — Review UID Values
Section titled “Step 04 — Review UID Values”Run:
getent passwd | cut -d: -f1,3Observe:
Username:UIDDo not assume specific UID ranges without checking your distribution’s configuration.
Security Principle
Section titled “Security Principle”The critical question is not:
Does the UsernameLook Like root?but:
Which UIDDoes the Account Have?Step 05 — Identify UID 0 Accounts
Section titled “Step 05 — Identify UID 0 Accounts”Run:
awk -F: '$3 == 0 {print $1 ":" $3 ":" $7}' /etc/passwdUID:
0represents root-level identity.
Any unexpected UID 0 account requires investigation.
Finding Example
Section titled “Finding Example”Finding:Unexpected UID 0 Account
Observation:An account other than the expected rootidentity is configured with UID 0.
Risk:The account effectively possessesroot-level operating-system identity.
Recommendation:Validate the business requirement,account ownership, authenticationcontrols, and remove unnecessary UID 0assignments through the approvedchange process.Part 03 — Understand GID
Section titled “Part 03 — Understand GID”Groups are identified through:
GIDReview:
getent groupFor your identity:
idYou may have:
Primary Group
Supplementary GroupsGroup-Based Access Model
Section titled “Group-Based Access Model”Instead of:
Give User A Access
Give User B Access
Give User C Accessprefer:
Resource ↓Group ↓Approved UsersThis becomes easier to administer and audit.
Part 04 — Create Training Groups
Section titled “Part 04 — Create Training Groups”Create three training groups:
sudo groupadd devteamsudo groupadd opsadminsudo groupadd secteamVerify:
getent group devteamgetent group opsadmingetent group secteamGroup Purpose
Section titled “Group Purpose”devteam ↓Development Resource Access
opsadmin ↓Approved Operational Administration
secteam ↓Security Resource AccessPart 05 — Create Training Users
Section titled “Part 05 — Create Training Users”Create:
sudo useradd -m alicesudo useradd -m bobsudo useradd -m charlieVerify:
getent passwd alicegetent passwd bobgetent passwd charlieUser Roles
Section titled “User Roles”Assign:
Alice ↓Developer
Bob ↓Operations Administrator
Charlie ↓Security AnalystStep 06 — Inspect Identities
Section titled “Step 06 — Inspect Identities”Run:
id aliceid bobid charlieRecord their:
UID
Primary GID
Supplementary GroupsPart 06 — Assign Group Membership
Section titled “Part 06 — Assign Group Membership”Add Alice:
sudo usermod -aG devteam aliceAdd Bob:
sudo usermod -aG opsadmin bobAdd Charlie:
sudo usermod -aG secteam charlieValidate:
id aliceid bobid charlieImportant Command Lesson
Section titled “Important Command Lesson”When modifying supplementary groups, understand the difference between:
Replace Membershipand:
Append MembershipThe -aG pattern is commonly used to append supplementary group membership.
Accidentally replacing groups can remove required access.
Part 07 — Create an IAM Matrix
Section titled “Part 07 — Create an IAM Matrix”Document:
| User | Role | Required Group | Admin Required |
|---|---|---|---|
| Alice | Developer | devteam | No |
| Bob | Operations | opsadmin | Limited |
| Charlie | Security Analyst | secteam | No |
This is your:
Expected IAM StateLater you will compare it against:
Actual IAM StatePart 08 — Account Lifecycle
Section titled “Part 08 — Account Lifecycle”Every account should have a lifecycle:
REQUEST ↓APPROVE ↓CREATE ↓ASSIGN ACCESS ↓REVIEW ↓MODIFY ↓DISABLE ↓REMOVESecurity Problem
Section titled “Security Problem”Many organizations perform:
CREATEvery well.
But forget:
REVIEWand:
REMOVEThis creates:
Orphaned Accounts
Excessive Access
Privilege AccumulationPart 09 — Review Password State
Section titled “Part 09 — Review Password State”For authorized training accounts, inspect account information.
Example:
sudo chage -l aliceReview concepts such as:
Password Change
Expiration
Minimum Age
Maximum Age
Warning PeriodImportant
Section titled “Important”Do not apply arbitrary password-aging values simply because a generic benchmark recommends them.
Follow:
Organization Policy
Authentication Architecture
Risk RequirementsPart 10 — Account Locking
Section titled “Part 10 — Account Locking”Suppose Alice temporarily leaves the project.
You may need:
Disable Accesswithout:
Delete IdentityIn an authorized lab, you can explore account-locking mechanisms appropriate to your distribution.
The important concept is:
Temporary Access Removal ≠Immediate Account DeletionWhy Preserve Accounts?
Section titled “Why Preserve Accounts?”During:
Employee Leave
Incident Investigation
Legal Hold
Access Reviewpreserving identity records may be important.
Part 11 — Account Expiration
Section titled “Part 11 — Account Expiration”Temporary users may require:
Automatic ExpirationExamples include:
Contractors
Temporary Administrators
Project Staff
Vendor AccountsThe preferred model is:
Access Needed Until Date X ↓Account Expires Automaticallyrather than:
Someone Will Rememberto Remove It LaterPart 12 — Service Accounts
Section titled “Part 12 — Service Accounts”Applications and services may require dedicated identities.
Create a harmless training system account:
sudo useradd --system --shell /usr/sbin/nologin ghcappOn some distributions the nologin path may differ.
Verify:
getent passwd ghcappService Account Model
Section titled “Service Account Model”Application ↓Dedicated Identity ↓Minimum Required AccessAvoid:
Application ↓rootunless there is a legitimate technical requirement that cannot be safely reduced.
Service Account Questions
Section titled “Service Account Questions”For every service account ask:
Which Application Owns It?
Does It Need Interactive Login?
Which Files Does It Need?
Which Services Does It Access?
Does It Need sudo?
Who Reviews It?Part 13 — Create Protected Resources
Section titled “Part 13 — Create Protected Resources”Create training directories:
sudo mkdir -p /srv/ghc/devsudo mkdir -p /srv/ghc/securitysudo mkdir -p /srv/ghc/applicationDesired Access
Section titled “Desired Access”/srv/ghc/dev ↓devteam
/srv/ghc/security ↓secteam
/srv/ghc/application ↓ghcappPart 14 — Configure Development Ownership
Section titled “Part 14 — Configure Development Ownership”Run:
sudo chown root:devteam /srv/ghc/devThen:
sudo chmod 2770 /srv/ghc/devReview:
ls -ld /srv/ghc/devWhy 2?
Section titled “Why 2?”The leading:
2sets SGID on the directory.
For shared directories, this can help newly created entries inherit the directory’s group ownership.
Desired Model
Section titled “Desired Model”Development Directory ↓Group = devteam ↓Development CollaborationPart 15 — Configure Security Directory
Section titled “Part 15 — Configure Security Directory”Run:
sudo chown root:secteam /srv/ghc/securityThen:
sudo chmod 2750 /srv/ghc/securityInterpret:
Owner ↓Full Access
Group ↓Read + Traverse
Others ↓No AccessPart 16 — Configure Application Directory
Section titled “Part 16 — Configure Application Directory”Assign the training service account:
sudo chown ghcapp:ghcapp /srv/ghc/applicationApply restrictive permissions:
sudo chmod 750 /srv/ghc/applicationVerify:
ls -ld /srv/ghc/applicationIAM Principle
Section titled “IAM Principle”Permissions should follow:
Resource Requirement ↓Identity ↓Minimum Necessary AccessPart 17 — Test Access
Section titled “Part 17 — Test Access”Do not assume configuration works because:
chmod SucceededValidate actual access.
Use approved methods to test your training identities.
For example:
sudo -u alice ls /srv/ghc/devTest Charlie:
sudo -u charlie ls /srv/ghc/securityThen test whether Alice can access the security directory:
sudo -u alice ls /srv/ghc/securityIf your permissions are working as designed, unauthorized access should fail.
Validation Model
Section titled “Validation Model”AUTHORIZED USER ↓ACCESS SUCCEEDS
UNAUTHORIZED USER ↓ACCESS DENIEDBoth tests matter.
Part 18 — Understand File Permissions
Section titled “Part 18 — Understand File Permissions”Linux discretionary permissions use:
OWNER
GROUP
OTHERSwith:
READ
WRITE
EXECUTENumeric Values
Section titled “Numeric Values”Read = 4
Write = 2
Execute = 1Examples:
700→ Owner only
750→ Owner full→ Group read/execute
770→ Owner and group full
640→ Owner read/write→ Group readSecurity Warning
Section titled “Security Warning”Avoid using:
777as a generic fix for:
Permission DeniedThis usually solves the symptom by creating a larger access problem.
Part 19 — Troubleshoot Permission Denied
Section titled “Part 19 — Troubleshoot Permission Denied”Use:
USER ↓GROUPS ↓FILE OWNER ↓FILE GROUP ↓FILE PERMISSIONS ↓PARENT DIRECTORY ↓ACL ↓SELINUX / APPARMORExample Commands
Section titled “Example Commands”id alicels -ld /srv/ghc/devnamei -l /srv/ghc/devwhere namei is available.
This helps identify permission problems across the directory path.
Part 20 — Access Control Lists
Section titled “Part 20 — Access Control Lists”Traditional permissions sometimes cannot express a business requirement cleanly.
Suppose:
Security Directory ↓secteam Has Accessbut Bob requires temporary read access without joining the security team.
This is where:
ACLmay help.
Step 07 — Check ACL Support
Section titled “Step 07 — Check ACL Support”Where ACL utilities are installed:
getfacl /srv/ghc/securityStep 08 — Grant a Training ACL
Section titled “Step 08 — Grant a Training ACL”In your authorized lab:
sudo setfacl -m u:bob:rx /srv/ghc/securityReview:
getfacl /srv/ghc/securitysudo -u bob ls /srv/ghc/securityIAM Meaning
Section titled “IAM Meaning”Bob now has:
Specific Accesswithout:
Permanent secteam MembershipPart 21 — Remove Temporary ACL
Section titled “Part 21 — Remove Temporary ACL”After testing:
sudo setfacl -x u:bob /srv/ghc/securityVerify:
getfacl /srv/ghc/securityThen test again.
Access Lifecycle
Section titled “Access Lifecycle”Grant ↓Use ↓Review ↓RevokeRevocation is just as important as granting access.
Part 22 — Default ACLs
Section titled “Part 22 — Default ACLs”Shared directories may require inherited access.
Conceptually:
Parent Directory ACL ↓New Files ↓Expected AccessDefault ACLs can help implement this.
However, they must be designed carefully to avoid granting unintended permissions to future files.
Part 23 — Review ACLs Professionally
Section titled “Part 23 — Review ACLs Professionally”ACLs create flexibility but can make access harder to understand.
When investigating permissions, never stop at:
ls -lAlso consider:
ACL
SELinux
AppArmor
Application-Level AuthorizationPart 24 — sudo
Section titled “Part 24 — sudo”Linux administrators frequently use:
sudoto perform privileged operations.
The objective is not:
Everyone Is RootThe objective is:
Approved User ↓Approved Administrative Action ↓Auditable PrivilegeStep 09 — Review Current sudo Access
Section titled “Step 09 — Review Current sudo Access”Run:
sudo -lUnderstand what your own lab account is authorized to perform.
Part 25 — Review sudo Configuration
Section titled “Part 25 — Review sudo Configuration”Important locations may include:
/etc/sudoers
/etc/sudoers.d/Never casually edit the main sudo configuration with an ordinary editor.
Use:
visudofor validated changes.
Part 26 — Least-Privilege sudo Design
Section titled “Part 26 — Least-Privilege sudo Design”Suppose Bob’s role is:
OperationsThat does not automatically mean:
Bob Needs Every Root CapabilityAsk:
Which Tasks?
Which Commands?
Which Servers?
Which Time Period?
Which Approval?Poor Model
Section titled “Poor Model”Operations User ↓Unlimited rootBetter Model
Section titled “Better Model”Operations User ↓Required Administrative Capability ↓Controlled sudo ↓LoggingImportant Security Note
Section titled “Important Security Note”Command-level sudo restrictions can be complex.
Some apparently limited commands may allow shell escapes, file modification, or indirect privilege escalation.
Therefore enterprise sudo policy requires careful design and testing.
Part 27 — sudo Logging
Section titled “Part 27 — sudo Logging”Administrative activity should be observable.
Review authentication and privilege-related logs appropriate to your distribution.
Possible locations include:
systemd Journal
/var/log/auth.log
/var/log/secureSecurity Question
Section titled “Security Question”Can you answer:
Who Used Privilege?
When?
From Where?
What Happened?Part 28 — SSH Identity
Section titled “Part 28 — SSH Identity”Remote Linux access often combines:
Linux Account +SSH AuthenticationSSH keys provide:
Public Key
Private KeyThe private key must remain protected by its owner.
SSH Authentication Model
Section titled “SSH Authentication Model”Client | | Proves possession | of private key vServer | | Matches approved | public key vLinux AccountPart 29 — Generate a Training SSH Key
Section titled “Part 29 — Generate a Training SSH Key”On your authorized lab workstation or disposable environment:
ssh-keygen -t ed25519Follow your environment’s secure key-handling process.
Prefer a meaningful file name rather than overwriting an existing identity.
Critical Rule
Section titled “Critical Rule”Never share:
Private KeyThe public key is designed to be distributed to systems that authorize that identity.
Part 30 — Review .ssh
Section titled “Part 30 — Review .ssh”For your own account:
ls -ld ~/.sshThen:
ls -la ~/.sshDo not display private key contents.
SSH IAM Review
Section titled “SSH IAM Review”Ask:
Which Keys Are Authorized?
Who Owns Them?
Are Any Shared?
Are Old Keys Present?
Can Keys Be Revoked?
Are Permissions Appropriate?Part 31 — authorized_keys
Section titled “Part 31 — authorized_keys”Authorized public keys are commonly associated with:
~/.ssh/authorized_keysTreat this file as:
Access Control Configurationbecause adding a public key may grant remote access to the account.
Finding Example
Section titled “Finding Example”Finding:Unmanaged SSH Key
Observation:An SSH public key is authorized for aprivileged Linux account but ownershipand business justification cannot beconfirmed.
Risk:An unknown or former key owner may retainremote access to the system.
Recommendation:Identify the key owner and requirement.Remove unauthorized keys and implementcentralized SSH key lifecycle management.Part 32 — Shared Accounts
Section titled “Part 32 — Shared Accounts”Suppose five administrators all use:
adminThis creates problems.
Administrator AAdministrator BAdministrator C ↓ admin ↓ ServerLogs may show:
admin performed actionbut not clearly:
Which Human?Better Model
Section titled “Better Model”Individual Identity ↓Controlled Privilege ↓Administrative ActionThis improves:
Accountability
Revocation
Auditing
InvestigationPart 33 — Root Account
Section titled “Part 33 — Root Account”The root account represents:
Maximum Local PrivilegeTreat it as:
Highly SensitiveAdministrative designs should generally favor:
Named Administrator ↓Controlled sudorather than routine shared root sessions.
Part 34 — Privilege Escalation Review
Section titled “Part 34 — Privilege Escalation Review”During IAM assessment, investigate:
UID 0 Accounts
Administrative Groups
sudo Rules
SUID Files
SGID Files
Privileged Services
Scheduled Tasks
SSH KeysIAM is broader than:
/etc/passwdPart 35 — Review SUID
Section titled “Part 35 — Review SUID”Inventory in your authorized lab:
sudo find / -xdev -type f -perm -4000 -print 2>/dev/nullDo not assume every SUID binary is malicious.
Instead ask:
Expected?
Package-Owned?
Required?
Approved Baseline?Part 36 — Review SGID
Section titled “Part 36 — Review SGID”Run:
sudo find / -xdev -type f -perm -2000 -print 2>/dev/nullAgain:
Identify ↓Understand ↓Compare Baseline ↓Investigate DeviationPart 37 — Orphaned Files
Section titled “Part 37 — Orphaned Files”Files may reference a UID or GID that no longer has a corresponding account.
In an authorized lab, you can review the local filesystem for orphaned ownership.
Conceptually look for:
Files Without Valid User
Files Without Valid GroupWhy This Matters
Section titled “Why This Matters”Suppose:
Old User UID = 1500is deleted.
Later:
New User Receives UID = 1500Old files may unexpectedly appear owned by the new user.
This is why identity lifecycle and file ownership are connected.
Part 38 — User Deprovisioning
Section titled “Part 38 — User Deprovisioning”Deleting a user is not simply:
userdelA proper workflow asks:
Which Files Do They Own?
Which Groups?
Which SSH Keys?
Which Scheduled Tasks?
Which sudo Rules?
Which Applications?
Which Tokens or Secrets?
Which Processes?Deprovisioning Workflow
Section titled “Deprovisioning Workflow”Disable Access ↓Preserve Required Evidence ↓Transfer Ownership ↓Remove Group Membership ↓Remove SSH Access ↓Remove Privilege ↓Remove Account ↓ValidatePart 39 — Find User-Owned Files
Section titled “Part 39 — Find User-Owned Files”For your training user Alice:
sudo find /home /srv -user alice -print 2>/dev/nullThis helps determine:
What DataWould Need ReviewDuring Deprovisioning?Part 40 — Review Processes by User
Section titled “Part 40 — Review Processes by User”Run:
ps -u aliceRepeat for other training identities where appropriate.
Before disabling or removing an identity, determine whether it currently owns important processes.
Part 41 — Review Scheduled Tasks
Section titled “Part 41 — Review Scheduled Tasks”For an authorized training user:
sudo crontab -u alice -lIf none exists, that is acceptable.
The important point is:
Account Removedshould not leave unmanaged:
Scheduled ExecutionPart 42 — IAM Access Review
Section titled “Part 42 — IAM Access Review”Now compare:
EXPECTED ACCESSagainst:
ACTUAL ACCESSYour original matrix was:
| User | Required Role |
|---|---|
| Alice | Developer |
| Bob | Operations |
| Charlie | Security |
Validate:
Groups
Filesystem Access
ACLs
sudo
SSH
Service AccessAccess Review Questions
Section titled “Access Review Questions”For every user ask:
Does the Account Still Need to Exist?
Is the Owner Known?
Are Group Memberships Correct?
Is Privilege Appropriate?
Are SSH Keys Current?
Does the User Own Unexpected Files?
Does the User Have Unexpected ACL Access?Part 43 — Privilege Creep
Section titled “Part 43 — Privilege Creep”Privilege creep occurs when users accumulate access over time.
Example:
Year 1Developer ↓devteam
Year 2Operations Project ↓opsadmin Added
Year 3Security Project ↓secteam AddedLater:
Current Role=Developerbut access remains:
devteam+opsadmin+secteamThis is:
Privilege AccumulationControl
Section titled “Control”Perform:
Periodic Access ReviewsPart 44 — Separation of Duties
Section titled “Part 44 — Separation of Duties”Some activities should not be controlled entirely by one person.
Example:
User Requests Privilege
Same User Approves Privilege
Same User Grants Privilegecreates weak governance.
A stronger model:
Request ↓Independent Approval ↓Provision ↓ReviewPart 45 — Just-in-Time Privilege
Section titled “Part 45 — Just-in-Time Privilege”Traditional model:
Administrator ↓Permanent PrivilegeMore mature environments may use:
Administrator ↓Request ↓Approval ↓Temporary Privilege ↓ExpirationThis is often called:
Just-in-Time AccessPart 46 — Least Privilege
Section titled “Part 46 — Least Privilege”Least privilege means:
Minimum Access
Required Resource
Required Task
Required DurationIt does not mean:
Give EveryoneRead-Only Accessto EverythingEven read access may expose sensitive information.
Part 47 — Zero Trust Connection
Section titled “Part 47 — Zero Trust Connection”Linux IAM can support Zero Trust principles.
Instead of:
User Is Inside Network ↓Trust Userthink:
Verify Identity
Validate Access
Limit Privilege
Log Activity
Review ContinuouslyPart 48 — Linux IAM in Cloud
Section titled “Part 48 — Linux IAM in Cloud”When Linux runs in the cloud, multiple IAM layers exist.
Example:
Cloud IAM ↓VM Access ↓Linux Account ↓sudo ↓ApplicationA user may have:
No Local Linux Passwordyet still gain VM access through cloud identity mechanisms.
Therefore cloud security assessments must evaluate:
Cloud IAM+Linux IAMPart 49 — Linux IAM and Containers
Section titled “Part 49 — Linux IAM and Containers”Containers may introduce:
Container User
Host User
Root Mapping
Service IdentityRunning an application as:
rootinside a container may increase risk depending on runtime configuration and isolation.
Prefer:
Non-Root Workloadwhere technically appropriate.
Part 50 — Linux IAM and Kubernetes
Section titled “Part 50 — Linux IAM and Kubernetes”Kubernetes adds another identity layer:
Human Identity ↓Kubernetes RBAC ↓Service Account ↓Pod ↓Container User ↓Linux KernelUnderstanding Linux IAM makes Kubernetes security easier to understand.
Part 51 — Linux IAM and Active Directory
Section titled “Part 51 — Linux IAM and Active Directory”Enterprise Linux systems may integrate with centralized identity platforms.
Conceptually:
Enterprise Directory ↓Linux Authentication ↓Group Mapping ↓sudo / Resource AccessBenefits may include:
Central Lifecycle
Central Authentication
Consistent Groups
Simpler RevocationLocal emergency identities may still exist depending on architecture.
Part 52 — Linux IAM and PAM
Section titled “Part 52 — Linux IAM and PAM”PAM stands for:
Pluggable Authentication ModulesIt provides a framework used by Linux services for authentication-related controls.
Conceptually:
Application ↓PAM ↓Authentication Modules ↓DecisionPAM may participate in controls related to:
Authentication
Account Restrictions
Sessions
Password ChangesDo not modify PAM configuration casually.
Incorrect changes can prevent legitimate authentication.
Part 53 — IAM Logging
Section titled “Part 53 — IAM Logging”Identity activity should generate useful evidence.
Important events include:
Login Success
Login Failure
sudo Use
Account Creation
Account Modification
Group Changes
Password Changes
SSH ActivitySOC Perspective
Section titled “SOC Perspective”The SOC may ask:
Who Logged In?
From Where?
When?
Was sudo Used?
Was a New User Created?
Was Group Membership Changed?Linux IAM controls should support answering these questions.
Part 54 — IAM Investigation Scenario
Section titled “Part 54 — IAM Investigation Scenario”Suppose an alert reports:
New User Addedto Administrative GroupInvestigate:
WHOWho created the user?
WHATWhich group was modified?
WHENWhen did it happen?
WHEREWhich server?
WHYWas there an approved change?
IMPACTWhat privilege did the user gain?Part 55 — IAM Finding: Excessive Group Membership
Section titled “Part 55 — IAM Finding: Excessive Group Membership”Finding:Excessive Group Membership
Observation:A user belongs to privileged groups thatare not required for the user's current role.
Risk:Unnecessary privileges increase the impactof credential compromise and accidentaladministrative actions.
Recommendation:Perform role-based access validation andremove group memberships that are notrequired.Part 56 — IAM Finding: Dormant Account
Section titled “Part 56 — IAM Finding: Dormant Account”Finding:Dormant Interactive Account
Observation:An interactive user account remainsenabled despite no confirmed currentbusiness requirement.
Risk:Unused accounts increase the availableauthentication attack surface.
Recommendation:Validate ownership and business need.Disable or remove the account throughthe approved identity lifecycle process.Part 57 — IAM Finding: Service Account Login
Section titled “Part 57 — IAM Finding: Service Account Login”Finding:Service Account Allows Interactive Login
Observation:A service identity is configured with aninteractive login shell despite noidentified operational requirement.
Risk:Compromise of the service credentials mayprovide unnecessary interactive access.
Recommendation:Confirm application requirements andrestrict interactive login where it isnot required.Part 58 — IAM Finding: Shared Administrative Account
Section titled “Part 58 — IAM Finding: Shared Administrative Account”Finding:Shared Administrative Account
Observation:Multiple administrators use the sameprivileged Linux identity.
Risk:Administrative activity cannot be reliablyattributed to an individual person andcredential revocation becomes difficult.
Recommendation:Use individually attributable identitieswith controlled privilege escalation andcentralized logging.Part 59 — IAM Finding: Stale SSH Key
Section titled “Part 59 — IAM Finding: Stale SSH Key”Finding:Stale SSH Authorization
Observation:An authorized SSH key remains configuredfor an identity whose current ownershipor business requirement cannot be verified.
Risk:A former or unauthorized key holder mayretain remote access.
Recommendation:Validate key ownership, remove stale keys,and implement a managed SSH key lifecycle.Part 60 — Build the IAM Report
Section titled “Part 60 — Build the IAM Report”Create:
Linux IAM Assessment ReportInclude:
1. System Information
Section titled “1. System Information”Hostname
Distribution
Date
Assessment Scope2. User Inventory
Section titled “2. User Inventory”Include:
Username
UID
Account Type
Login Shell
Owner
Status3. Group Inventory
Section titled “3. Group Inventory”Include:
Group
GID
Purpose
Members4. Privileged Access
Section titled “4. Privileged Access”Review:
UID 0
Administrative Groups
sudo
SUID/SGID5. Remote Access
Section titled “5. Remote Access”Review:
SSH Accounts
SSH Keys
Administrative SSH Access6. Resource Access
Section titled “6. Resource Access”Review:
Ownership
Permissions
ACLs7. Service Accounts
Section titled “7. Service Accounts”Document:
Account
Application
Interactive Login
Privilege
Owner8. Findings
Section titled “8. Findings”For every issue include:
Title
Observation
Risk
Evidence
Recommendation
PriorityPart 61 — IAM Evidence Checklist
Section titled “Part 61 — IAM Evidence Checklist”Capture appropriate non-sensitive evidence for:
- Current user
- UID/GID
- User inventory
- Group inventory
- UID 0 review
- Interactive shell review
- Training users
- Training groups
- Group membership
- Directory ownership
- Permissions
- ACLs
- sudo review
- Service account
- SSH configuration
- SSH authorization review
- SUID/SGID review
- Scheduled task review
- IAM findings
Never include:
Passwords
Password Hashes
Private SSH Keys
Tokens
SecretsPart 62 — IAM Validation Matrix
Section titled “Part 62 — IAM Validation Matrix”Before completing the lab, validate:
| Identity | Dev Directory | Security Directory | Administrative Access |
|---|---|---|---|
| Alice | Allowed | Denied | No |
| Bob | As Required | Denied after ACL removal | Limited/As Designed |
| Charlie | Denied unless required | Allowed | No |
| ghcapp | Application only | Denied | No |
Your exact implementation may differ, but every permission should have a reason.
Part 63 — Negative Testing
Section titled “Part 63 — Negative Testing”Security validation must test both:
What Should Workand:
What Should FailExamples:
Alice Can Access Development ✓
Alice Cannot Access Security ✓
Charlie Can Access Security ✓
Service Account CannotInteractively Log In ✓A control is not fully validated if you test only successful access.
Part 64 — Clean Up Temporary ACL
Section titled “Part 64 — Clean Up Temporary ACL”Confirm Bob’s temporary ACL has been removed:
getfacl /srv/ghc/securityValidate Bob no longer receives the temporary access.
Part 65 — Lab Cleanup
Section titled “Part 65 — Lab Cleanup”Only after completing your evidence collection, remove identities created solely for this disposable lab if they are no longer needed.
Before deletion review:
Files
Processes
Scheduled Tasks
Groups
ACLs
sudo
SSHThen use your distribution’s approved account-removal process.
Do not remove legitimate system identities.
Part 66 — IAM Operational Runbook
Section titled “Part 66 — IAM Operational Runbook”A professional access request should follow:
REQUEST ↓Identify User
JUSTIFICATION ↓Why Is Access Required?
APPROVAL ↓Who Authorizes It?
PROVISION ↓Grant Minimum Access
VALIDATE ↓Test Required Access
LOG ↓Record Change
REVIEW ↓Is Access Still Required?
REVOKE ↓Remove When No Longer NeededPart 67 — Access Review Frequency
Section titled “Part 67 — Access Review Frequency”High-risk access should be reviewed more frequently than low-risk access.
Examples:
Root / sudo ↓High Priority
Service Accounts ↓High Priority
Production SSH ↓High Priority
Standard Low-Risk Access ↓Periodic ReviewThe exact frequency should follow organizational policy and risk.
Part 68 — Linux IAM Security Model
Section titled “Part 68 — Linux IAM Security Model”Your final model should be:
PERSON ↓INDIVIDUAL IDENTITY ↓AUTHENTICATION ↓GROUP / ROLE ↓LEAST PRIVILEGE ↓RESOURCE ↓LOGGING ↓PERIODIC REVIEW ↓REVOCATIONCommon Linux IAM Mistakes
Section titled “Common Linux IAM Mistakes”Avoid:
Shared Administrator Accounts
Permanent Root Access
Unnecessary sudo
chmod 777
Unmanaged SSH Keys
Interactive Service Accounts
Stale User Accounts
Excessive Group Membership
No Access Reviews
No Account Owner
No Expiration for Temporary Access
Deleting Accounts Without Reviewing Files
Ignoring ACLs
Ignoring SUID/SGID
Ignoring Cloud IAM Above the VMCareer Connection
Section titled “Career Connection”The skills in this lab directly support:
Linux Administrator
Linux Security Engineer
IAM Engineer
SOC Analyst
Cloud Security Engineer
DevSecOps Engineer
Incident Responder
Security ConsultantInterview Scenario 01
Section titled “Interview Scenario 01”A developer says they need root because their application occasionally requires administrative changes. What should you do?
Use:
Understand Task ↓Identify Required Privilege ↓Determine Safer Delegation ↓Apply Least Privilege ↓Log UsageDo not automatically grant unrestricted root access.
Interview Scenario 02
Section titled “Interview Scenario 02”An employee leaves the organization. Is deleting their Linux account enough?
No.
Review:
SSH Keys
Groups
sudo
Files
Processes
Scheduled Tasks
Application Access
Tokens
SecretsInterview Scenario 03
Section titled “Interview Scenario 03”A user has correct Unix permissions but still cannot access a file. What else should you check?
Review:
Parent Directory Permissions
ACLs
SELinux
AppArmor
Application ControlsInterview Scenario 04
Section titled “Interview Scenario 04”Why are shared administrator accounts problematic?
Because they reduce:
Accountability
Attribution
Revocation Precision
Audit QualityInterview Scenario 05
Section titled “Interview Scenario 05”What is privilege creep?
It is the accumulation of access over time as a user’s responsibilities change without previous permissions being removed.
40 Linux IAM Interview Questions
Section titled “40 Linux IAM Interview Questions”- What is Linux IAM?
- What is authentication?
- What is authorization?
- What is a UID?
- What is a GID?
- Why is UID 0 security-sensitive?
- What is a primary group?
- What is a supplementary group?
- Why are groups useful for access management?
- What is least privilege?
- What is privilege creep?
- What is separation of duties?
- What is an account lifecycle?
- Why should dormant accounts be disabled?
- What is a service account?
- Why should service accounts avoid interactive login when unnecessary?
- What is file ownership?
- What do
rwxpermissions mean? - What does permission
750mean? - Why is
777usually a poor troubleshooting solution? - What is SGID on a directory?
- What is an ACL?
- When would you use an ACL?
- How do ACLs affect permission troubleshooting?
- What is sudo?
- Why is unrestricted sudo risky?
- Why should sudo changes be validated?
- Why are individual administrator accounts preferable to shared accounts?
- What is an SSH public key?
- Why must SSH private keys remain protected?
- What is
authorized_keys? - Why should stale SSH keys be removed?
- What is SUID?
- Why should SUID files be reviewed?
- What are orphaned files?
- Why should file ownership be reviewed before deleting a user?
- What is just-in-time privileged access?
- How does Linux IAM interact with cloud IAM?
- How does Linux IAM support incident response?
- How would you conduct a privileged-access review?
Lab Completion Checklist
Section titled “Lab Completion Checklist”Identity
Section titled “Identity”- Reviewed current identity
- Reviewed UID and GID
- Reviewed local users
- Identified UID 0 accounts
- Reviewed interactive accounts
Groups
Section titled “Groups”- Reviewed groups
- Created training groups
- Assigned users
- Validated membership
- Created access matrix
Account Lifecycle
Section titled “Account Lifecycle”- Reviewed password/account information
- Understood locking
- Understood expiration
- Understood deprovisioning
- Reviewed user-owned resources
Permissions
Section titled “Permissions”- Created protected directories
- Configured ownership
- Configured group permissions
- Tested authorized access
- Tested denied access
- Understood SGID directories
- Reviewed ACL support
- Granted temporary ACL
- Validated access
- Removed temporary ACL
- Validated revocation
Privilege
Section titled “Privilege”- Reviewed sudo
- Understood least-privilege sudo
- Reviewed UID 0
- Reviewed SUID
- Reviewed SGID
Service Accounts
Section titled “Service Accounts”- Created training service account
- Restricted interactive login
- Assigned application resource
- Reviewed service-account privilege
- Understood SSH key authentication
- Reviewed
.ssh - Reviewed authorized-key concepts
- Understood key lifecycle
- Protected private keys
Security Review
Section titled “Security Review”- Reviewed excessive access
- Reviewed stale identities
- Reviewed privileged access
- Reviewed account ownership
- Reviewed logging
- Documented findings
Mission Accomplished
Section titled “Mission Accomplished”You have now built and assessed a practical Linux IAM model covering:
Users
UIDs
Groups
GIDs
Account Lifecycle
Service Accounts
Ownership
Permissions
ACLs
sudo
SSH Keys
Privileged Access
Access Reviews
DeprovisioningYou have moved from:
Creating Linux Usersto understanding:
Enterprise LinuxIdentity and Access ManagementThe professional IAM mindset is:
WHO ↓NEEDS WHAT ↓FOR WHICH PURPOSE ↓FOR HOW LONG ↓WITH WHICH PRIVILEGE ↓HOW WILL IT BE AUDITED ↓WHEN WILL IT BE REMOVEDWhat’s Next?
Section titled “What’s Next?”➡️ Lab 04 — Linux Networking
In the next lab, you will move from identity security to Linux network administration and security.
You will work through:
Network Interfaces ↓IP Addressing ↓Subnetting ↓Routing ↓Default Gateway ↓DNS ↓TCP and UDP ↓Listening Ports ↓Connections ↓Network Services ↓Host Firewall ↓Network Troubleshooting ↓Security AnalysisYour Linux lab journey continues:
Lab 01 — Linux Administration ↓Lab 02 — Linux Hardening ↓Lab 03 — Linux IAM ↓Lab 04 — Linux Networking ↓Lab 05 — Linux Security ↓Runbook 01 — Linux Incident Investigation ↓Runbook 02 — Linux Security Assessment ↓Runbook 03 — Linux Server Hardening