Ravindra BagaleCourses & study guides मराठी Track your progress

Chapter 3: Linux Basic Commands

AWS Cloud

3.6 Users, groups and sudo

Friends, many people work on the same server – the Amul-style dairy's developer, the admin and the web server itself. A separate user for each, with only the rights they need – these are the rules of Linux.

Command Purpose
whoami Effective user name
id User and group IDs and active groups of the current process
useradd Create a local user with specified account options. Some distributions also provide an interactive adduser tool.
passwd Manage account passwords according to system policy.
usermod -aG GROUP LOGIN Append a supplementary group. Administrative group names and rights depend on system policy.
groupadd Create a local group.
groups LOGIN Look up the named account's configured groups. Omit the login for the current process's groups.
userdel -r LOGIN Administrative removal of a local account. The recursive account option can remove the home directory and mail spool. Review dependencies and retained data first.
su - LOGIN Start a login-style shell for the target when authentication and policy allow.
sudo -i Request a target login shell when policy permits. The usual target is root. Use exit to leave the shell.

Local account and group records commonly live in /etc/passwd and /etc/group. Systems can also consult other configured identity sources. Password data in /etc/shadow belongs to a protected account management workflow. Local sudoers files are one source of command policy. Authorized administrators use visudo for controlled editing and syntax checks.

Why sudo instead of logging in as root?

sudo requests a command under a target identity when policy allows it. The usual target is root. The scope, authentication and logging depend on policy. Common EC2 Linux image defaults use a regular username with sudo available and disable direct root SSH access. Review the specific AMI and instance configuration.

Ravindra Bagale's Tip

Many students run sudo usermod -G devops ravi and forget -a – then all of ravi's other supplementary groups (even wheel/sudo) are gone. Always write -aG: -a means append. Never forget it!

Lab

Chala, check the identity and groups of your current shell. Compare that session with a lookup for the same user. This exercise does not change accounts or grant administrative access.

whoami
id
login_name=$(id -un)
id -Gn
id -Gn "$login_name"

The first group list describes the current command. The second looks up the named account. Think about the result after a group membership change while an earlier login is still active. The worked report lab below gives you that exact scenario.

Start with the person or program doing the work

Mauli Dairy's supervisor asks Deepa to read the daily support report and mark any missed pickups in a separate review file. She is new to the team and signs in using her own account. Suresh prepares the report, which is generated automatically by a program each morning. A machine administrator maintains the service that runs the program. During the first attempt, Deepa sees Permission denied when she opens the daily report. Someone suggests giving her full administrator access. Pause and write down what she actually needs. She needs to open a particular report and write in a designated review area. She does not need to install software, create accounts or control the program that writes the report.

Linux uses an identity to decide who is making a request. That identity can represent a person such as Deepa, or a program such as the report generator. A group can represent a shared role, such as report reviewers. You can assign the report's read access to the reviewer group once. Then authorized reviewers can acquire the appropriate access through their own group membership. Each still logs in as an individual. When someone changes roles, the team can review the affected account and its membership. There is no need to pass around a shared login password or a common SSH private key.

We will work with four independent pieces of information. Which user is running the command? Which groups are active in that process? Which user and group own the destination file or directory? What extra operating authority does policy grant for a specific command? These facts come from different places. A terminal prompt can be customized, so it is a hint. Account records can be correct while an older process still has an earlier group list. A group may own a file with insufficient read permissions. A user may be allowed to list an administrative rule and still be refused permission for a different command. Label the evidence before choosing how to repair the issue.

This lesson uses an imaginary report, imaginary account records and a local Linux identity check. You can do the core practice on your own learning terminal with your ordinary login. Use a non-root account to see the expected differences. The account and group changes in the example are described using records you can read. You will not need an actual second account, a real policy edit or an administrator password to reason about the outcome. If you practise on an EC2 server, use a learning instance assigned to you and verify that it is the machine you intended to open before continuing.

Connect words such as Deepa and reviewers to numeric IDs

A user account has a numeric user identifier, called a UID. A group has a numeric group identifier, called a GID. Names make a terminal easier to use. Internally a file stores the numeric owner and group. A tool can resolve those numbers into names by consulting the operating system's configured account sources. If the machine cannot resolve a number, some listings display the number in place of a name. This is common when inspecting data moved from another system or a filesystem mounted in a different environment. Before reassigning any files, learn whether the number is expected and which account on the current system it represents.

An ordinary user generally starts with a primary group, specified in the account record. The user may also be a member of supplementary groups. Groups can be created for teams or service tasks. Deepa's primary group might be named deepa. The supplementary group report-reviewers can give her a shared role. A file owned by the relevant report group can be made readable through its group bits, if she can also reach the file through its parent directories. Adding Deepa to a group never independently decides which files that group can read. Every shared directory and file still has its own access configuration.

Compare the following example output with your own. The numbers in the example belong to the imaginary lab. Real numbers, names and order can differ. The name beside UID is the user reported by the command. GID shows the primary group for this ordinary example. The final section lists active groups for that process, including the relevant one it can use to read the report.

whoami
id
id -u
id -g
id -Gn
deepa
uid=1104(deepa) gid=1104(deepa) groups=1104(deepa),1308(report-reviewers)
1104
1104
deepa report-reviewers

The whoami response shows the effective user name. Effective means the identity that ordinarily participates in making access decisions. The plain id command gives a larger summary and can show distinctions when its real and effective credentials differ. With no username argument, it describes the process that ran it. Use that form inside the shell whose access you are investigating. The smaller option forms return individual pieces. The final group-name list is convenient when a teammate says you need one named group. Take care with the difference between a group name and its number, especially when comparing two environments.

On Linux the account associated with UID zero, traditionally named root, ordinarily has wide authority within its environment. Root can administer many system settings, manage files outside its own home and perform operations restricted to ordinary users. Linux capabilities, namespaces, network filesystems and additional security policy can constrain what even a privileged process is allowed to do. For this lesson, the important observation is that a successful read in a powerful administrative shell tells you little about the user who originally saw the denial. Use the everyday identity for everyday checks.

Read an account entry without exposing password data

On many Linux systems, the Name Service Switch, usually called NSS, tells account lookup tools where to search. A local account is typically represented in /etc/passwd, and local groups often appear in /etc/group. A managed server can also consult an identity provider for accounts. That provider may be a directory maintained by the organization. A search of one local file cannot settle whether a particular centrally managed user exists. Use the system's targeted lookup tool when available. On Linux with the appropriate support, getent can request account and group records from the configured sources.

lesson_login=$(id -un)
if command -v getent > /dev/null 2>&1; then
  getent passwd "$lesson_login" | cut -d ':' -f 1,3,4,6,7
else
  printf '%s\n' 'getent is unavailable here. Use the example to read the Linux fields.'
fi
deepa:1104:1104:/home/deepa:/bin/bash

The targeted query asks for the entry whose name matches the current user. The pipeline passes the text to cut, which uses the colon character to locate fields. The example prints the account name, UID, primary GID, home path and login shell. You excluded the password field and the account description. The word passwd names the account database used by the lookup. In many modern local configurations the password field in the public account record contains a marker such as an x. Password hashes and related password aging information are kept in the protected shadow database or handled by another provider. You do not need to retrieve that protected information to investigate an ordinary report read.

Read the home and shell fields separately. The home path is the directory assigned to the account. It may hold the user's own work and settings. The login shell is the program the login system can start to interpret commands, subject to how the account authenticates and what logins are allowed. A service account may have a restricted or disabled interactive shell and still own files and run a background process. A record being present does not imply a working password or an enabled SSH login. To diagnose authentication, consult the approved login method and account status rather than trying to read the password database.

If the targeted lookup produces no line, stop and inspect the reason. With a pipeline, the receiving tool can finish successfully without seeing any input. Run the targeted getent passwd query on its own only if it is appropriate on your training host, and check its exit status immediately. A failure can mean the key is absent or that a provider could not supply it. Consult the local manual for the exact statuses. In a centrally managed environment a directory service can be temporarily unreachable. A missing lookup is evidence about what this machine could resolve at this time. It is insufficient on its own to justify creating a duplicate local account.

A group entry likewise has a name and a numeric GID. Its explicit member list may describe supplementary memberships. A user's primary group can be assigned through the account record without that user appearing in the group's explicit member list. If Deepa's name is missing from the group record but the group is her primary GID, the missing membership string alone tells the wrong story. Comparing the configured account view with the active command view gives you a more reliable answer.

Compare the account's configured groups with the groups a live process has

The administrator confirms that Deepa was approved to join report-reviewers. When Deepa asks for the configured account groups, the right team name appears. Her existing terminal still cannot read the report. This can happen because a login session normally initializes its own user and group credentials at the start. Its child processes inherit those credentials. Changing the account's configured supplementary groups does not directly replace the group list inside every existing process. Returning to the old terminal and running the same report viewer can therefore reproduce the failure, even though a newly established login would receive different credentials.

lesson_login=$(id -un)
printf '%s\n' 'Groups active in this shell:'
id -Gn
printf '%s\n' 'Groups resolved for this account:'
id -Gn "$lesson_login"
Groups active in this shell:
deepa
Groups resolved for this account:
deepa report-reviewers

In the imaginary output, the first line is the active view and the last line is a named lookup. The active view reports that this shell currently lacks the reviewer group. The named lookup reports that the account source now returns that group. The example suggests a fresh authorized login as the next test. It does not suggest changing the report file to be readable by all the other accounts. In a service environment a process may need to be restarted through its approved maintenance procedure for it to pick up an updated group configuration. Verify which process is making the request and whether the service setup explicitly supplies its own groups.

If the active and configured group names are already the same, the mismatch is elsewhere. Check whether the file's numeric GID is the same group, whether ordinary group permissions allow the intended action and whether all parent folders permit search. A service accessing a file through another mount or a container may see a different path tree. The access example might be about your shell while the ticket names a process launched on another host. Write down the actual host, user, directory and filename before interpreting the result.

Linux administrators can add approved members using the local identity tooling when an account is managed locally. The shadow-utils program usermod uses -G to specify supplementary group membership. With the append flag -a, the selected groups are added to the existing list. Without append, other existing supplementary memberships can be removed. The primary group is a separate account field. A team that manages its users through a directory service will usually change membership through that service's process. Read the existing membership, confirm the exact group and verify the resulting configuration and fresh session for a planned membership change.

The name of a group alone does not say that it gets elevated privileges. Some distributions commonly configure wheel or sudo to participate in that permission, depending on the installed rules. Report reviewers need the group used for report read access. Adding them to a broad administrator group would change access far beyond what the support job requires. A scoped membership decision should connect to a particular path and action. Confirm the connection with an actual report read by the authorized account.

Check the numeric credentials behind the friendly names

Deepa copies the diagnostic note to her teammate on a second training host. Both hosts know the name report-reviewers. On the first host it resolves to group 1308, as in our report example. On the second host the same group name resolves to 2308. Someone restores a tar archive from the first host using a workflow that preserves the numeric group. The report on disk still shows 1308 when inspected numerically. A login with group 2308 on the second host will not match that stored group just because its name sounds right. That gives us a testable problem separate from stale credentials. Determine the intended identity mapping before making any ownership change.

The ordinary long listing resolves names. Combine its options with -n when you want numeric UID and GID values for the same object. On the current machine you can run the following simple checks on your own home directory. The -d option shows the directory as an object. Compare which fields stayed stable when you requested names versus numbers. A user's numeric effective group can differ from the directory's owner group. The commands are two views of the same directory metadata, so the group on the directory remains the same object property in both.

ls -ld -- "$HOME"
ls -ldn -- "$HOME"
id -G

The third command displays the group IDs for the current process as numbers. This lets you match what the directory stores with what the process can use in the ordinary group check. In our two-host example, if that list contains 2308 but not 1308, the mismatch explains why the process fails to receive the stored group's read privilege. Repeatedly logging in does not repair a wrong group assignment on the restored data. Ask the restore or filesystem owner whether the source IDs are expected to persist, be mapped or be reassigned under the target environment's policy. Fixing the group on one explicitly identified report is very different from reassigning every restored object.

On Linux with the process information filesystem available, you can also look up a compact set of credentials for your own current shell. A process ID is the number a system uses to identify a running instance of a program. The shell substitutes $$ with its own process ID in the following command. The filtered output reports the values for the process whose number appears in the path. This read does not change any credentials.

if [ -r "/proc/$$/status" ]; then
  awk '/^(Uid|Gid|Groups):/ { print }' "/proc/$$/status"
fi

Expect three lines when the Linux path is readable and available. The UID and GID lines each contain four numeric fields. Linux reports real, effective, saved and filesystem IDs in that order. In an everyday shell, the four values on a given line usually match. The final line describes supplementary groups. Start by comparing it with the numeric groups shown by the earlier command. The full set of groups can also include the primary group, so the two listing formats may display that number in different places. The practice lookup describes the shell you actually named. In a support case for a background worker, select the real worker and check only what you are authorized to inspect.

Use the three numbers in a short diagnostic statement for the restored report. State the report's stored group, the reviewer's active group and the group's resolved name on the current host. Then predict whether the basic group mode applies and explain the mismatched values. A teammate can reproduce these checks without knowing Deepa's password or logging in to her account. This makes the support note both useful and suitable for an ordinary operations channel.

Read a sudo request as a policy decision

sudo is used to request that a command run as another user or group, when policy allows it. The common default target user is root. A policy can also allow a specific action as a less powerful service user. There are at least three identities to keep separate at the point of an administrative request. There is the login that started the command. There is the account the operation requests to use. There is the process that will touch the file or manage the service. For a simple approved command the last two may be the same. For a command that starts a service, the service can use a separate identity defined by its own configuration.

Think of a site administrator who is allowed to perform a bounded health check for the report service. That authorization can specify an exact operation, a target identity and the relevant host. It leaves the administrator free to perform normal report work using a regular identity. The administrator can look at an approved rule to see the action that is permitted. A policy can require the caller to authenticate, or choose different rules for different commands. A cached authentication decision may reduce repeat prompts. The absence of a prompt does not imply every command is authorized. The scope still comes from policy.

On a machine where your instructor or administrator approves checking your own policy, sudo -l lists the privileges that apply to you. If authentication is needed, the normal form may prompt. The non-interactive form below asks for the list without prompting. Run it only in your authorized learning environment. The core exercise works from the example beneath it if your machine has no such access or you prefer to skip the check.

sudo -n -l
User mira may run the following commands on training-box:
    (report-worker) /usr/local/sbin/check-report-status

That line is fictional. The command listed there is part of the example, and it will not exist on your practice computer. Interpret it as permission to request the named check as report-worker on the indicated host, subject to the rule and its options. It gives no evidence that Mira can run a root shell. If the listing check says a password is required, the non-interactive query could not complete its authentication under the current conditions. If it explicitly says the user is refused, follow the team's access request procedure and include the relevant action. Preserve the difference between a failed attempt to authenticate and a confirmed policy denial.

Local sudoers policy often uses /etc/sudoers and included configuration. It can also be managed from elsewhere by the organization. A maintainer can use visudo for syntax checking and controlled editing in the documented workflow, because a broken rule can interrupt access for administrators. A syntax check cannot prove a rule gives only the intended privilege. Someone still has to review the permitted command, its arguments, its target identity and any trust it places in modifiable files. Logging depends on the configured policy and supporting system. Some systems use the journal, others log through a separate facility, and detailed input or output logging can require separate configuration.

Find which process opened the file

One common stumbling block comes from shell redirection. Suppose an operator writes a command that uses sudo to run an approved reporting utility and places a greater-than sign after it to save the output. The current shell ordinarily handles the redirection. It attempts to open the output path before running the requested program. If that path is a protected administrative directory, the shell itself can be denied even when policy allows the approved reporting action. Diagnose that by naming the program that opens each file. The program reads its data. The current shell opens the redirection destination. The two operations can have different access contexts.

Use a destination you are authorized to write when collecting a personal diagnostic, and only include information appropriate to that destination. If a workflow requires system output stored in a protected administrative location, have its owner approve the command and destination together. Running an entire shell with broad privilege changes many more operations than just opening one output path. One purpose of a bounded administrative command is to keep the rest of your workflow under ordinary permissions. This is an especially useful habit when typing a command you learned on a different host.

su can start an account switch subject to authentication and system policy. Its login form starts a login-style environment for the target. sudo commonly evaluates a particular request from the invoking account and can also start a shell in authorized configurations. These forms can change the effective identity, startup environment and working directory. When someone says they were on the right host but in the wrong home directory, ask whether they started a new login shell. Check id, pwd and the intended file. The prompt can also carry old-looking text that makes guessing risky.

On EC2, a login account from the instance's operating system is different from an IAM identity that can call AWS APIs. The Amazon Machine Image determines the usual default username and access setup for the Linux instance. Amazon Linux and Ubuntu images commonly use different starting names. AWS documents key-based, non-root SSH access for common defaults, and a custom image or administrator can configure the machine differently. If a command in a shell needs AWS access, inspect its authorized AWS credential source or instance role along with the Linux access needed to run it. Changing local file owner or invoking a root command does not provide an IAM permission by itself.

Run a read-only account check and model the support case

The first two steps take observations from the current login. If you are on a local Mac, the displayed names and identifiers will reflect that OS, and getent might be unavailable. The account table exercise uses fictional Linux-style entries and runs in either Bash environment with standard tools. Open a new shell if it makes the lab easier to track. You need the ability to make an ordinary private directory in your home. No elevated command is required.

  1. Run whoami, id and pwd. Note the visible effective user name, numeric UID, primary group and one supplementary group if present. These facts describe the shell that launched the commands. If your UID is zero, switch to a normal learning shell before comparing your access with the ordinary account in the example.

  2. Run the two group queries in the earlier section and compare them. Most students will see the same memberships. That means their current process and account lookup agree on these groups at that moment. If there is a difference, record which query displayed the extra group. Leave the current memberships alone. Identifying the two views is the goal of this step.

  3. Create a private fixture with text that resembles two small account records and two group entries. The names and numbers are invented. The files have a distinct name and live in a temporary directory. The mask applies in a subshell to make the fixture files private in normal circumstances.

identity_lab=$(mktemp -d "$HOME/identity-lesson.XXXXXXXX") &&
  cd -- "$identity_lab" &&
  (
    umask 077
    printf '%s\n' 'deepa:x:1104:1104:Reviewer:/home/deepa:/bin/bash' \
      'report-worker:x:1240:1240:Report worker:/srv/report:/usr/sbin/nologin' > ./accounts-example.txt &&
    printf '%s\n' 'deepa:x:1104:' 'report-reviewers:x:1308:deepa' > ./groups-example.txt
  ) &&
  pwd && ls -ld -- ./accounts-example.txt ./groups-example.txt

Read the printed path and check it is your new practice directory. If setup reports an error or does not print a new lab path, stop and resolve that before the next step. The filenames make these learning inputs easy to recognize. They are plain text in your workspace and have no effect on your computer's account lookup. The group called deepa has an empty explicit member field. Before deciding membership, look at the primary GID in the account record.

awk -F ':' '$1 == "deepa" { print $1, $3, $4, $6, $7 }' ./accounts-example.txt
awk -F ':' '$1 == "report-reviewers" { print $1, $3, $4 }' ./groups-example.txt
awk -F ':' '$1 == "report-worker" { print $1, $3, $7 }' ./accounts-example.txt
deepa 1104 1104 /home/deepa /bin/bash
report-reviewers 1308 deepa
report-worker 1240 /usr/sbin/nologin

Here awk reads the sample file and uses a colon to split each line into its fields. The condition matches the complete first field. The first query prints Deepa's UID, primary GID, home and login shell. Group 1104 is her primary group even though its own record has no members listed. The second query shows that the group entry 1308 includes Deepa. The third query shows the program account with a shell path that is ordinarily used to deny interactive login. In this model, the program's ability to own an output file is independent of an ordinary login to that account.

Predict this report's result from imaginary live evidence. The file's line shows -rw-r----- with owner report-worker and group report-reviewers. Its directory shows drwxr-x--- with the same owner and group. The parent path is searchable for the intended users. Deepa's active group list on her old shell includes only group 1104. In a fresh login after approved membership is visible, her list includes 1104 and 1308. The older shell ordinarily falls into the other class and cannot traverse the report directory. The new shell uses the group search on the directory and group read on the file. She can read the report and still lacks the plain group write bit on the report itself. If she requires a write area, the review directory can be given separately.

Finish by checking the path and clearing only the sample files. Answer prompts only when their paths match this lab. If you choose to keep the fixtures, their directory can remain in your home for a later exercise. If a cleanup step finds additional files, inspect the directory before deciding whether to remove anything else.

pwd
ls -la -- .
if [ -n "$identity_lab" ] && [ "$(pwd -P)" = "$(cd -- "$identity_lab" && pwd -P)" ]; then
  rm -i -- ./accounts-example.txt ./groups-example.txt &&
    cd -- "$HOME" &&
    rmdir -- "$identity_lab"
fi

Write a support note that an administrator can act on

Imagine Deepa's support message started with “My permission is not working.” To act on it, the administrator needs the account and host, the operation and path, the exact error and whether a fresh session behaves differently. Record those facts from tools before you include what you believe the reason is. For the exercise, you can write “The existing Deepa session cannot read the daily report path. The configured account query now shows the reviewer group and the active session query omits it. The report uses that group's read bit and the parent uses its search bit. A fresh authorized session is the next check.” This links what you saw to a specific action.

Test the smallest useful hypothesis. First compare session groups. If a fresh session solves the problem, verify the final read and record the time and identities. If the group appears in both views and the denial remains, verify the file owner and owning group on the host that actually contains the report. Use ls -ld for each relevant parent. Verify the directory and file permission bits agree with what the reader needs. If those checks predict success, look for ACLs or another access control layer with the administrator. A different failure can come from an editor that writes a temporary file. In that case the intended operation includes creating and renaming a directory entry, and its parent permissions belong in the support note.

When someone joins, changes roles or leaves, preserve the information that matters for access without sharing credentials. An account retirement can leave files, automated tasks or scheduled work owned by its numeric UID. Removing a system user can affect running processes, scheduled jobs, file ownership and service availability. An administrator should identify those dependencies and follow the organization's retention and account lifecycle process. Verify any group or account change from new authorized access and record the result. The lesson's safe fixture files train this reasoning without modifying the real account database.

One useful way to check your diagnosis is to predict two outcomes. Deepa should be able to open the report from a fresh session. She should still be denied any attempt to change the published source report if the role is read-only. A separate review area is the place authorized writes should succeed. In a real environment ask the deployment owner about a harmless test designed for the second condition. The point of the pair is to verify that the correct job is enabled and the access boundary still holds. Greater privilege is not a successful diagnosis unless the planned job truly requires it.

Interview questions with worked answers

What is the difference between a username, a UID and a GID?

A username gives a person-friendly label to an account, whose UID is the numeric identifier used by the operating system. A GID identifies a group. A file's owner and owning group are stored as numeric IDs. In the example, Deepa is UID 1104. Her group 1104 can be distinct from the additional report reviewer group 1308. I would compare numeric IDs if two hosts resolve the same name differently or one listing has no name for a stored number.

A new group appears in id deepa, but it is absent from the plain id output she ran. What happened?

The named query asks the account sources what memberships are defined for that account. The query without a user name describes the credentials of the process invoking it. Her existing shell can retain the groups set up when she logged in. I would try a fresh authorized login, then check that the active credentials contain the group and retry the exact read. If a background service is making the request, I would investigate that service's credentials separately.

Why might a service account with an interactive login restriction still show up in a file listing?

Ownership is a numeric association stored on a file. A service can run as that account if the service manager is configured to launch it, while the account has a restricted login shell for human sign-in. In the report example, the worker owns the generated report. Deepa has a different login and accesses it through the group. The login restriction places a boundary on interactive session behavior rather than removing the worker's filesystem identity.

Is group membership enough to read a group-owned file?

The group identity is one part. I would verify file group read, directory search for the entire path and the active membership of the process that needs access. Check the owner first because it can take precedence over the simple group class. Additional controls can apply. Our fixture shows the shape of a good result when the active supplementary group matches and file read and directory search are assigned to that group.

What information would you ask for before granting sudo access?

I would ask what single operation needs a different identity, which account should run it and which host, paths and inputs are involved. For the dairy report review, normal file and directory group access satisfies the request. If an operator needs a service health check, the manager can assess a bounded rule for that check and its target identity. An administrative policy should be understandable and verifiable independently of the user's ordinary file access.

Check your understanding

1. Which command best answers which groups this particular shell can use now?

A. id -Gn
B. id -Gn deepa from another session
C. A count of the lines in the local account file

Answer and reasoning

A. The no-username form reports the command's own active credentials. The named query can reflect a newer account configuration. A line count does not identify a process's groups.

2. Deepa needs to read a report whose dedicated group grants read and path search. Which change fits her job?

A. Give full administrator rights to every reviewer.
B. Add approved reviewers to the report group and check their fresh sessions.
C. Make every private report writable by all users.

Answer and reasoning

B. It connects the approved users to the access already intended for report readers. Verify the exact operation and path after membership is active.

3. What is the effect of the append option used with the local supplementary group option?

A. It adds the listed groups while preserving other supplementary memberships.
B. It changes the user's UID to the group's GID.
C. It replaces the user's current primary group.

Answer and reasoning

A. The append option is used with the supplementary group option. Choose it when the approved operation is addition. Review the configured and active views after a change.

4. An approved status command succeeds by itself. A version with output redirected into a protected directory fails. What should you check first?

A. The owner of the SSH private key on a different computer.
B. The account that the report script originally created.
C. The current shell's access to the destination it is trying to open.

Answer and reasoning

C. Shell redirection can be performed before the command runs, under the current shell's credentials. The status utility and the output destination involve different operations.

5. A configured account record exists with UID 1240 and a restricted login shell. What can still be true?

A. A service launched under UID 1240 owns a file.
B. All IAM API requests run as UID 1240.
C. The protected password fields should be readable by the report worker.

Answer and reasoning

A. File ownership and service execution can use that identity independently of interactive login. Linux and IAM access are distinct.

Revision cards

Who is acting?

Identify the user and the active groups in the process that makes the request. A named lookup can describe a newer account record. It may differ from the credentials of an old session.

Use the account matching its job

Individuals use their own logins. A service starts with its assigned identity. Shared read access can come from a group. Check the specific file and its parents.

Numbers carry ownership

Files store owner UID and group GID. Name service can present readable account names. Record the numbers when diagnosing a transfer across different machines.

Fresh session after approved changes

Compare the active and configured group lists. A newly established login can pick up a changed membership. Verify the report read using that session.

A sudo rule describes a request

Know who requests the command, the target identity, and the scope the policy allows. Listing access and executing a command are different checks. Authentication behavior depends on policy.

Find the opener

The shell performs ordinary redirection. A program may make its own separate file opens. Compare each operating system request with the identity that performed it.

Official references