14.7 id, whoami, groups: Inspecting Current Identity

Right, let’s get the existential stuff out of the way. Before you can start bossing the system around, you need to answer the most fundamental question in a multi-user environment: “Who am I?” and “What am I allowed to do?” It sounds philosophical, but the answers are brutally practical. You’re not a beautiful and unique snowflake to the kernel; you’re just a number. A user ID (UID). Let’s meet the tools that translate that number back into a name and tell you what teams you’re on.

14.6 passwd: Changing Passwords and Account Locking

Right, let’s talk about the passwd command. You probably think it’s just for changing your password. And you’d be mostly right. But it’s also the Swiss Army knife for poking at your own user account, and if you’re the all-powerful root user, it’s the master key for poking at everyone else’s account. It’s deceptively simple, which is why its nuances often bite people in the rear. The most basic incantation is the one you know. You type passwd, it asks for your current password (a sanity check to make sure a passerby hasn’t hijacked your session), then prompts you for a new one twice to avoid typos. It then hashes that password using a modern, secure algorithm (like yescrypt on modern systems) and slaps that hash into the /etc/shadow file. Simple.

14.5 groupadd, groupmod, groupdel: Managing Groups

Right, let’s talk about herding cats. Or, more accurately, herding users. On a Linux system, you don’t manage users individually; you manage them in bulk by putting them into groups. It’s the only sane way to handle permissions for more than one person. The trio of commands for this job—groupadd, groupmod, and groupdel—are deceptively simple. They look like they just add, modify, and delete groups. And… well, they do. But the devil, as always, is in the details, and some of those details are frankly a bit weird.

14.4 useradd, usermod, userdel: Managing User Accounts

Right, let’s talk about the three amigos of user management: useradd, usermod, and userdel. These are your low-level, no-frills tools for the job. They don’t hold your hand, they don’t ask you twenty questions, and they will happily let you shoot yourself in the foot if you’re not careful. Think of them as the grumpy but brilliant sysadmin who sits in the corner and gets stuff done—if you know the right incantations.

14.3 /etc/group: Group Definitions and Members

Right, let’s talk about /etc/group. You’ve met its sibling, /etc/passwd. This file is the other half of that core identity system, but it’s where things get interesting because it’s all about collaboration (and, occasionally, utter chaos). Think of /etc/passwd as your ID card—it says who you are. /etc/group is the list of all the clubs and teams you belong to. And just like in real life, being in the right group is what gives you the key to the secret lab, the admin lounge, or the shared donut fund.

14.2 /etc/shadow: Hashed Passwords and Account Aging

Right, let’s talk about the one file on your system that’s actually supposed to be a secret: /etc/shadow. If /etc/passwd is the public directory—listing everyone’s names and user IDs—then /etc/shadow is the high-security vault where the actual credentials are kept. Its existence is a direct lesson from the early days of UNIX when everyone’s hashed password just sat in /etc/passwd, world-readable. Yes, you read that correctly. It was a disaster. shadow was invented to fix that monumental oopsie.

14.1 /etc/passwd: Format, Fields, and Shell Field

Right, let’s talk about /etc/passwd. No, it’s not where your computer’s passwords go—that’s the first and most important misconception to shatter. If it were, it would be the world’s worst-kept secret, sitting there world-readable for any process to peek at. The name is a fossil, a relic from a more trusting, simpler time. The actual password hashes got moved to the more secure /etc/shadow file decades ago. What’s left in /etc/passwd is the public, user-account metadata. Think of it as the phonebook for your system’s users.

— joke —

...