Permission Is a Question about Identity
A file can exist at the right path and still be unreadable. Linux evaluates the identity of the process requesting access, not whether the person recognizes the filename. A program is executable code; a process is a running instance with an identity and a process ID, or PID. Several processes can run the same program without being the same instance.
Use the course guest, Bash, ordinary ubuntu user. Resume as described in
workspace setup.
The files from Lesson 3 are not required. Create a separate exercise directory:
cd "$HOME/vecta-devops"
pwd -P
id
mkdir identity-practice
cd identity-practice
printf '%s\n' 'environment=practice' > settings.conf
chmod u=rw,go= settings.conf
ls -l settings.conf
Stop if the parent is not /home/ubuntu/vecta-devops, the user is root or the
child already contains unknown work. For your own resumed exercise, inspect
the child before entering it and do not overwrite settings.conf.
id shows the user and group memberships. A group collects identities that
can share access. chmod changes permission bits on a file you own: u is the
owner, g its group and o everyone else. = sets the listed bits, r means
read and w write. Thus u=rw,go= grants owner read/write and grants neither
group nor others any permission. It changes access, not the file contents.
An illustrative listing begins -rw------- ubuntu ubuntu. The first -
means a regular file; three triplets describe owner, group and other access.
Dates, spacing and file sizes vary. The owner should be ubuntu.

Follow the request through the permission check. Changing file ownership and granting more permission are different operations; this task needs neither root nor a new owner.
For ordinary files, x permits execution. For directories, x means traversal:
the ability to reach a named entry. Directory r allows listing names and w
allows modifying entries when combined with the needed traversal permission.
A readable file inside a non-traversable directory can still be inaccessible.
These basic mode bits are not the only Linux controls; additional policies or
ACLs can matter. Our newly created guest files use the simple case.
Break One Bit and Repair It
In the owned identity-practice directory, remove only owner read permission:
chmod u-r settings.conf
cat settings.conf
Expect Permission denied from cat as ordinary ubuntu. This intentional
failure is the point of the exercise; do not interpret it as a request for
sudo cat. Root can bypass ordinary access checks and would hide this fault.
Inspect and repair the owner bit:
ls -l settings.conf
chmod u+r settings.conf
cat settings.conf
The file should again print environment=practice. u+r adds one permission
without granting access to every other user. A blanket chmod 777 would grant
read/write/execute to all three classes and obscure the actual requirement.
Do not change permissions on a whole home directory to repair this one file.
A PID Is Not a Permanent Name
Stay in this same shell. Start a harmless process that waits for five minutes:
sleep 300 &
practice_pid=$!
printf '%s\n' "$practice_pid"
ps -p "$practice_pid" -o pid=,user=,comm=
& starts a background job so the shell can accept another command. $! is
the PID of the most recent background command; save it immediately, before
starting another job. Assignment has no spaces around =. $practice_pid
retrieves that shell variable. ps -p inspects this PID; -o chooses columns,
and = suppresses their headings. Expect your user and command sleep.
After checking that it is still your sleep process, stop just that instance:
kill -TERM "$practice_pid"
wait "$practice_pid"
TERM asks a process to terminate. wait collects your shell child's result;
a nonzero result is expected after termination, not evidence that another
process failed. Never copy the numeric PID from an example. PIDs can be reused
after a process exits, and shell variables disappear in a new terminal.
If the wait expired or the identity changed, do not send a signal. This process
ends by itself after 300 seconds; there is no need for a broad killall.
Leave a Small, Understandable State
Keep the repaired synthetic file or remove only settings.conf with rm -i
inside its verified directory, then go to its parent and use
rmdir identity-practice. Stop the course VM from the host when pausing.
Do not leave a guessed PID in a notebook as a future cleanup instruction.
If the initial read still succeeds after u-r, check id -u: root is a common
reason. If ps has no row, the process may already have ended. If access remains
denied after repair, inspect the path and ownership before changing more bits.
Predict before Repairing
A diagnostic says a process running as ubuntu cannot read its owned file,
whose mode begins --w-------. Which single change fits? Would making the
program executable help? Why should a saved PID from yesterday not be killed?
Answer and Reasoning
Add owner read with chmod u+r settings.conf in the confirmed exercise
directory. Execution permission does not grant permission to read a data file.
Yesterday's PID may belong to an unrelated process now. Inspect identity and
ownership at the time of action, or use the named service controls taught next.
References
- Ubuntu chmod, ps and Bash job control.