Audit the Shell Environment: Detect a Shadowed Command
The laborant user's shell environment on rocky-01 has been tampered with — a dangerous sudo alias and a useradd shell function have been injected into ~/.bashrc, and you must clean them up before any administrative work can proceed safely.
Complete the following tasks on rocky-01 as the laborant user.
Hint 1 — How to detect what's wrong
Use type sudo and declare -f useradd in an interactive session to confirm whether a command is aliased or shadowed by a shell function.
Hint 2 — Where to look
The injected definitions live in ~/.bashrc. Open it with a text editor and look for lines containing alias sudo= and a useradd() function block.
Hint 3 — What to remove
Delete the alias sudo='...' line and the entire useradd() { ... } function block including the export -f useradd line. Save the file, then open a new shell to verify the changes took effect.
Hint 4 — How to verify your fix
In a new shell session, run:
alias sudo 2>&1
declare -f useradd
echo $PATH | tr ':' '\n' | grep '^/usr/bin$'
The first two commands should produce no output. The third should print /usr/bin.