Understand identities and sessions
By the end: Identify the effective user, current sessions, and where elevated access comes from.
The idea
A process runs with an identity and group memberships. That identity may differ from the person who originally logged in. Observe first; do not switch accounts or change a password on a shared machine merely to complete a lesson. Session tools depend on the distribution and whether login accounting is enabled.
Your command toolkit
whoami
What it solves: Identify the effective user.
whoami
Reports the user associated with the current effective UID. After an authorized identity change, it may differ from the original login user.
who
What it solves: Inspect recorded login sessions.
who
Reads login accounting information. Containers and some modern sessions may not appear in this traditional record.
w
What it solves: See logged-in sessions and activity.
w
Combines session details with uptime and load information. It is a different command from finger.
groups
What it solves: Inspect current group memberships.
groups
Groups contribute to permission checks. A membership change may require a new login session to take effect.
finger
What it solves: Read account information where supported.
finger "$(whoami)"
An optional, older tool. Limit practice to your own local account; remote finger services may be absent and can expose personal information.
last
What it solves: Review recorded login history.
last -n 5
Reads historical login accounting, if available. Missing records do not prove that no one logged in.
login
What it solves: Understand how a login session starts.
man login
Study the installed implementation. Running login can replace or change a session, so this course uses its manual rather than opening another account.
passwd
What it solves: Inspect password status without changing it.
passwd -S
On common shadow-utils systems, -S reports your own account's password status. Running passwd without that option starts a password change.
su
What it solves: Understand switching to another identity.
su --help
su starts a shell or command as another user, subject to authentication. A login shell changes more environment settings than a simple user switch.
sudo
What it solves: Inspect how authorized elevation works.
sudo -l
Lists commands your policy permits and may ask for authentication. sudo is an authorization boundary, not a general fix for any error.
Before you move on
Try the guided lab below. Compare the result with the explanation, then record your reasoning in the workbook. A missing optional program or a restricted environment is something to explain, not a reason to change system settings blindly.
Practice with evidence
- Predict the result
- Run the guided lab
- Compare the output
- Explain your choice
A worked example
Guided lab
whoami
groups
w
who
What to expect: Your effective username and groups, plus whatever session information your environment records. Empty session listings are possible.
Make it yours: Record the distinction between effective identity and login history. Explain when a permission error should be investigated rather than retried with sudo.
Read further
- Debian reference: Linux fundamentals ↗www.debian.org
Apply what you learned
Your private practice
Answers are private. Completion requires the correct knowledge-check answer and a written response when an activity is included.
Restore a downloaded workbook
Choose a recovery file for this course and version. Review the recovered copy before saving it to your account.
Ask a question or report a problem
Describe what needs attention. Your private answer is shared only if you select the option below.